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>
This commit is contained in:
Anna Schumaker
2021-10-22 13:11:00 -04:00
committed by Trond Myklebust
parent d4a95a7e5a
commit d755ad8dc7
4 changed files with 36 additions and 20 deletions

View File

@@ -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;