aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@Netapp.com>2021-10-22 13:11:00 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-11-05 14:54:38 -0400
commitd755ad8dc752d44545613ea04d660aed674e540d (patch)
tree130f7533dc968a4a943d9c4c1947d13826769f71 /fs/nfs/inode.c
parentNFS: Always initialise fattr->label in nfs_fattr_alloc() (diff)
downloadlinux-dev-d755ad8dc752d44545613ea04d660aed674e540d.tar.xz
linux-dev-d755ad8dc752d44545613ea04d660aed674e540d.zip
NFS: Create a new nfs_alloc_fattr_with_label() function
For creating fattrs with the label field already allocated for us. I also update nfs_free_fattr() to free the label in the end. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 0b5b1e44b2c4..84c7efa2ea87 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1606,6 +1606,23 @@ struct nfs_fattr *nfs_alloc_fattr(void)
}
EXPORT_SYMBOL_GPL(nfs_alloc_fattr);
+struct nfs_fattr *nfs_alloc_fattr_with_label(struct nfs_server *server)
+{
+ struct nfs_fattr *fattr = nfs_alloc_fattr();
+
+ if (!fattr)
+ return NULL;
+
+ fattr->label = nfs4_label_alloc(server, GFP_NOFS);
+ if (IS_ERR(fattr->label)) {
+ kfree(fattr);
+ return NULL;
+ }
+
+ return fattr;
+}
+EXPORT_SYMBOL_GPL(nfs_alloc_fattr_with_label);
+
struct nfs_fh *nfs_alloc_fhandle(void)
{
struct nfs_fh *fh;