]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
NFS: Pass the inode down to the getattr() callback
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 7 Apr 2018 17:50:59 +0000 (13:50 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 4 Jun 2018 16:07:07 +0000 (12:07 -0400)
Allow the getattr() callback to check things like whether or not we hold
a delegation so that it can adjust the attributes that it is asking for.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/client.c
fs/nfs/dir.c
fs/nfs/export.c
fs/nfs/inode.c
fs/nfs/nfs3proc.c
fs/nfs/nfs4proc.c
fs/nfs/proc.c
include/linux/nfs_xdr.h

index b9129e2befeaa4186138bbd84e78d7ca2d128370..02e97c29af0c54400f473dfc9074a90e5a943413 100644 (file)
@@ -969,7 +969,8 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info,
        }
 
        if (!(fattr->valid & NFS_ATTR_FATTR)) {
-               error = nfs_mod->rpc_ops->getattr(server, mount_info->mntfh, fattr, NULL);
+               error = nfs_mod->rpc_ops->getattr(server, mount_info->mntfh,
+                               fattr, NULL, NULL);
                if (error < 0) {
                        dprintk("nfs_create_server: getattr error = %d\n", -error);
                        goto error;
index 978a22ea962cf79c225c8fae55b991995984c7c1..7a9c14426855309d2bb68e681b2db32321648d0c 100644 (file)
@@ -1656,7 +1656,8 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
        nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
        if (!(fattr->valid & NFS_ATTR_FATTR)) {
                struct nfs_server *server = NFS_SB(dentry->d_sb);
-               error = server->nfs_client->rpc_ops->getattr(server, fhandle, fattr, NULL);
+               error = server->nfs_client->rpc_ops->getattr(server, fhandle,
+                               fattr, NULL, NULL);
                if (error < 0)
                        goto out_error;
        }
index ab5de3246c5c34c3640a9464da8a6a87ece68d8e..deecb67638aa94d55a171529053dc7096a6a014c 100644 (file)
@@ -102,7 +102,7 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
        }
 
        rpc_ops = NFS_SB(sb)->nfs_client->rpc_ops;
-       ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, label);
+       ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, label, NULL);
        if (ret) {
                dprintk("%s: getattr failed %d\n", __func__, ret);
                dentry = ERR_PTR(ret);
index 5de724b1b90cb7868160f9d5cb24212fa7eb79e1..a720427e5aa3843888aa1d02058945f2608c86ca 100644 (file)
@@ -1101,7 +1101,8 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
                goto out;
        }
 
-       status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, label);
+       status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr,
+                       label, inode);
        if (status != 0) {
                dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n",
                         inode->i_sb->s_id,
index 5645ef4c52593612d925f2cae8d05dca2d6c4aeb..ec8a9efa268fec13f78daaf347b37a6b707d6f1e 100644 (file)
@@ -101,7 +101,8 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
  */
 static int
 nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
-               struct nfs_fattr *fattr, struct nfs4_label *label)
+               struct nfs_fattr *fattr, struct nfs4_label *label,
+               struct inode *inode)
 {
        struct rpc_message msg = {
                .rpc_proc       = &nfs3_procedures[NFS3PROC_GETATTR],
index c44cfa6be8ff876968ff7b9147b33ba438bdeb4f..cd60e8360ef24383230e388faeea765987ff309d 100644 (file)
@@ -92,8 +92,8 @@ static void nfs4_layoutget_release(void *calldata);
 static int _nfs4_recover_proc_open(struct nfs4_opendata *data);
 static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *);
 static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr);
-static int nfs4_proc_getattr(struct nfs_server *, struct nfs_fh *, struct nfs_fattr *, struct nfs4_label *label);
-static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs4_label *label);
+static int nfs4_proc_getattr(struct nfs_server *, struct nfs_fh *, struct nfs_fattr *, struct nfs4_label *label, struct inode *inode);
+static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs4_label *label, struct inode *inode);
 static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
                            struct nfs_fattr *fattr, struct iattr *sattr,
                            struct nfs_open_context *ctx, struct nfs4_label *ilabel,
@@ -2494,7 +2494,8 @@ static int _nfs4_proc_open(struct nfs4_opendata *data,
        }
        if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) {
                nfs4_sequence_free_slot(&o_res->seq_res);
-               nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, o_res->f_label);
+               nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr,
+                               o_res->f_label, NULL);
        }
        return 0;
 }
@@ -3763,7 +3764,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *mntfh,
        if (IS_ERR(label))
                return PTR_ERR(label);
 
-       error = nfs4_proc_getattr(server, mntfh, fattr, label);
+       error = nfs4_proc_getattr(server, mntfh, fattr, label, NULL);
        if (error < 0) {
                dprintk("nfs4_get_root: getattr error = %d\n", -error);
                goto err_free_label;
@@ -3828,7 +3829,8 @@ static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir,
 }
 
 static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
-                               struct nfs_fattr *fattr, struct nfs4_label *label)
+                               struct nfs_fattr *fattr, struct nfs4_label *label,
+                               struct inode *inode)
 {
        struct nfs4_getattr_arg args = {
                .fh = fhandle,
@@ -3852,12 +3854,13 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 }
 
 static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
-                               struct nfs_fattr *fattr, struct nfs4_label *label)
+                               struct nfs_fattr *fattr, struct nfs4_label *label,
+                               struct inode *inode)
 {
        struct nfs4_exception exception = { };
        int err;
        do {
-               err = _nfs4_proc_getattr(server, fhandle, fattr, label);
+               err = _nfs4_proc_getattr(server, fhandle, fattr, label, inode);
                trace_nfs4_getattr(server, fhandle, fattr, err);
                err = nfs4_handle_exception(server, err,
                                &exception);
index 763f77e7f1f13c8284f4f81d55f996d7a44c48a8..e0c257bd62b938372f957b58177458fe37c9f0da 100644 (file)
@@ -99,7 +99,8 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
  */
 static int
 nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
-               struct nfs_fattr *fattr, struct nfs4_label *label)
+               struct nfs_fattr *fattr, struct nfs4_label *label,
+               struct inode *inode)
 {
        struct rpc_message msg = {
                .rpc_proc       = &nfs_procedures[NFSPROC_GETATTR],
index 09dc14ac58046dd3454eec9f862ef14ab5d3ec12..9dee3c23895d82fae05025961fe83d15b23d45b7 100644 (file)
@@ -1581,7 +1581,8 @@ struct nfs_rpc_ops {
        struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
                                     struct nfs_subversion *);
        int     (*getattr) (struct nfs_server *, struct nfs_fh *,
-                           struct nfs_fattr *, struct nfs4_label *);
+                           struct nfs_fattr *, struct nfs4_label *,
+                           struct inode *);
        int     (*setattr) (struct dentry *, struct nfs_fattr *,
                            struct iattr *);
        int     (*lookup)  (struct inode *, const struct qstr *,