diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2018-04-07 13:50:59 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-06-04 12:07:07 -0400 |
commit | a841b54dbd65421726caf7129f8951910c7a8ea6 (patch) | |
tree | 6d39aa190863b61863885ad66c8247f21746af9c | |
parent | 30846df06f937b692ea658aaf7e28acf56a255f8 (diff) |
NFS: Pass the inode down to the getattr() callback
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>
-rw-r--r-- | fs/nfs/client.c | 3 | ||||
-rw-r--r-- | fs/nfs/dir.c | 3 | ||||
-rw-r--r-- | fs/nfs/export.c | 2 | ||||
-rw-r--r-- | fs/nfs/inode.c | 3 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 3 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 17 | ||||
-rw-r--r-- | fs/nfs/proc.c | 3 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 3 |
8 files changed, 23 insertions, 14 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index b9129e2befea..02e97c29af0c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -969,7 +969,8 @@ struct nfs_server *nfs_create_server(struct nfs_mount_info *mount_info, | |||
969 | } | 969 | } |
970 | 970 | ||
971 | if (!(fattr->valid & NFS_ATTR_FATTR)) { | 971 | if (!(fattr->valid & NFS_ATTR_FATTR)) { |
972 | error = nfs_mod->rpc_ops->getattr(server, mount_info->mntfh, fattr, NULL); | 972 | error = nfs_mod->rpc_ops->getattr(server, mount_info->mntfh, |
973 | fattr, NULL, NULL); | ||
973 | if (error < 0) { | 974 | if (error < 0) { |
974 | dprintk("nfs_create_server: getattr error = %d\n", -error); | 975 | dprintk("nfs_create_server: getattr error = %d\n", -error); |
975 | goto error; | 976 | goto error; |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 978a22ea962c..7a9c14426855 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1656,7 +1656,8 @@ int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, | |||
1656 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 1656 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
1657 | if (!(fattr->valid & NFS_ATTR_FATTR)) { | 1657 | if (!(fattr->valid & NFS_ATTR_FATTR)) { |
1658 | struct nfs_server *server = NFS_SB(dentry->d_sb); | 1658 | struct nfs_server *server = NFS_SB(dentry->d_sb); |
1659 | error = server->nfs_client->rpc_ops->getattr(server, fhandle, fattr, NULL); | 1659 | error = server->nfs_client->rpc_ops->getattr(server, fhandle, |
1660 | fattr, NULL, NULL); | ||
1660 | if (error < 0) | 1661 | if (error < 0) |
1661 | goto out_error; | 1662 | goto out_error; |
1662 | } | 1663 | } |
diff --git a/fs/nfs/export.c b/fs/nfs/export.c index ab5de3246c5c..deecb67638aa 100644 --- a/fs/nfs/export.c +++ b/fs/nfs/export.c | |||
@@ -102,7 +102,7 @@ nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | rpc_ops = NFS_SB(sb)->nfs_client->rpc_ops; | 104 | rpc_ops = NFS_SB(sb)->nfs_client->rpc_ops; |
105 | ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, label); | 105 | ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, label, NULL); |
106 | if (ret) { | 106 | if (ret) { |
107 | dprintk("%s: getattr failed %d\n", __func__, ret); | 107 | dprintk("%s: getattr failed %d\n", __func__, ret); |
108 | dentry = ERR_PTR(ret); | 108 | dentry = ERR_PTR(ret); |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 5de724b1b90c..a720427e5aa3 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1101,7 +1101,8 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
1101 | goto out; | 1101 | goto out; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, label); | 1104 | status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, |
1105 | label, inode); | ||
1105 | if (status != 0) { | 1106 | if (status != 0) { |
1106 | dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n", | 1107 | dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n", |
1107 | inode->i_sb->s_id, | 1108 | inode->i_sb->s_id, |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 5645ef4c5259..ec8a9efa268f 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -101,7 +101,8 @@ nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
101 | */ | 101 | */ |
102 | static int | 102 | static int |
103 | nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | 103 | nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, |
104 | struct nfs_fattr *fattr, struct nfs4_label *label) | 104 | struct nfs_fattr *fattr, struct nfs4_label *label, |
105 | struct inode *inode) | ||
105 | { | 106 | { |
106 | struct rpc_message msg = { | 107 | struct rpc_message msg = { |
107 | .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR], | 108 | .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR], |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index c44cfa6be8ff..cd60e8360ef2 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -92,8 +92,8 @@ static void nfs4_layoutget_release(void *calldata); | |||
92 | static int _nfs4_recover_proc_open(struct nfs4_opendata *data); | 92 | static int _nfs4_recover_proc_open(struct nfs4_opendata *data); |
93 | static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); | 93 | static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); |
94 | static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr); | 94 | static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr); |
95 | static int nfs4_proc_getattr(struct nfs_server *, struct nfs_fh *, struct nfs_fattr *, struct nfs4_label *label); | 95 | static int nfs4_proc_getattr(struct nfs_server *, struct nfs_fh *, struct nfs_fattr *, struct nfs4_label *label, struct inode *inode); |
96 | static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs4_label *label); | 96 | static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs4_label *label, struct inode *inode); |
97 | static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, | 97 | static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, |
98 | struct nfs_fattr *fattr, struct iattr *sattr, | 98 | struct nfs_fattr *fattr, struct iattr *sattr, |
99 | struct nfs_open_context *ctx, struct nfs4_label *ilabel, | 99 | struct nfs_open_context *ctx, struct nfs4_label *ilabel, |
@@ -2494,7 +2494,8 @@ static int _nfs4_proc_open(struct nfs4_opendata *data, | |||
2494 | } | 2494 | } |
2495 | if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) { | 2495 | if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) { |
2496 | nfs4_sequence_free_slot(&o_res->seq_res); | 2496 | nfs4_sequence_free_slot(&o_res->seq_res); |
2497 | nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, o_res->f_label); | 2497 | nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, |
2498 | o_res->f_label, NULL); | ||
2498 | } | 2499 | } |
2499 | return 0; | 2500 | return 0; |
2500 | } | 2501 | } |
@@ -3763,7 +3764,7 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *mntfh, | |||
3763 | if (IS_ERR(label)) | 3764 | if (IS_ERR(label)) |
3764 | return PTR_ERR(label); | 3765 | return PTR_ERR(label); |
3765 | 3766 | ||
3766 | error = nfs4_proc_getattr(server, mntfh, fattr, label); | 3767 | error = nfs4_proc_getattr(server, mntfh, fattr, label, NULL); |
3767 | if (error < 0) { | 3768 | if (error < 0) { |
3768 | dprintk("nfs4_get_root: getattr error = %d\n", -error); | 3769 | dprintk("nfs4_get_root: getattr error = %d\n", -error); |
3769 | goto err_free_label; | 3770 | goto err_free_label; |
@@ -3828,7 +3829,8 @@ out: | |||
3828 | } | 3829 | } |
3829 | 3830 | ||
3830 | static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | 3831 | static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, |
3831 | struct nfs_fattr *fattr, struct nfs4_label *label) | 3832 | struct nfs_fattr *fattr, struct nfs4_label *label, |
3833 | struct inode *inode) | ||
3832 | { | 3834 | { |
3833 | struct nfs4_getattr_arg args = { | 3835 | struct nfs4_getattr_arg args = { |
3834 | .fh = fhandle, | 3836 | .fh = fhandle, |
@@ -3852,12 +3854,13 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | |||
3852 | } | 3854 | } |
3853 | 3855 | ||
3854 | static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | 3856 | static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, |
3855 | struct nfs_fattr *fattr, struct nfs4_label *label) | 3857 | struct nfs_fattr *fattr, struct nfs4_label *label, |
3858 | struct inode *inode) | ||
3856 | { | 3859 | { |
3857 | struct nfs4_exception exception = { }; | 3860 | struct nfs4_exception exception = { }; |
3858 | int err; | 3861 | int err; |
3859 | do { | 3862 | do { |
3860 | err = _nfs4_proc_getattr(server, fhandle, fattr, label); | 3863 | err = _nfs4_proc_getattr(server, fhandle, fattr, label, inode); |
3861 | trace_nfs4_getattr(server, fhandle, fattr, err); | 3864 | trace_nfs4_getattr(server, fhandle, fattr, err); |
3862 | err = nfs4_handle_exception(server, err, | 3865 | err = nfs4_handle_exception(server, err, |
3863 | &exception); | 3866 | &exception); |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 763f77e7f1f1..e0c257bd62b9 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -99,7 +99,8 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
99 | */ | 99 | */ |
100 | static int | 100 | static int |
101 | nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, | 101 | nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, |
102 | struct nfs_fattr *fattr, struct nfs4_label *label) | 102 | struct nfs_fattr *fattr, struct nfs4_label *label, |
103 | struct inode *inode) | ||
103 | { | 104 | { |
104 | struct rpc_message msg = { | 105 | struct rpc_message msg = { |
105 | .rpc_proc = &nfs_procedures[NFSPROC_GETATTR], | 106 | .rpc_proc = &nfs_procedures[NFSPROC_GETATTR], |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 09dc14ac5804..9dee3c23895d 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1581,7 +1581,8 @@ struct nfs_rpc_ops { | |||
1581 | struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, | 1581 | struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, |
1582 | struct nfs_subversion *); | 1582 | struct nfs_subversion *); |
1583 | int (*getattr) (struct nfs_server *, struct nfs_fh *, | 1583 | int (*getattr) (struct nfs_server *, struct nfs_fh *, |
1584 | struct nfs_fattr *, struct nfs4_label *); | 1584 | struct nfs_fattr *, struct nfs4_label *, |
1585 | struct inode *); | ||
1585 | int (*setattr) (struct dentry *, struct nfs_fattr *, | 1586 | int (*setattr) (struct dentry *, struct nfs_fattr *, |
1586 | struct iattr *); | 1587 | struct iattr *); |
1587 | int (*lookup) (struct inode *, const struct qstr *, | 1588 | int (*lookup) (struct inode *, const struct qstr *, |