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 /fs/nfs/nfs4proc.c | |
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>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 17 |
1 files changed, 10 insertions, 7 deletions
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); |