diff options
author | Jan Kara <jack@suse.cz> | 2016-05-26 10:55:18 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2016-09-22 04:56:19 -0400 |
commit | 31051c85b5e2aaaf6315f74c72a732673632a905 (patch) | |
tree | a3bdc58adf95cd02276f44188f6b33c9f06f5e1a /fs/nfsd/nfsproc.c | |
parent | 62490330769c1ce5dcba3f1f3e8f4005e9b797e6 (diff) |
fs: Give dentry to inode_change_ok() instead of inode
inode_change_ok() will be resposible for clearing capabilities and IMA
extended attributes and as such will need dentry. Give it as an argument
to inode_change_ok() instead of an inode. Also rename inode_change_ok()
to setattr_prepare() to better relect that it does also some
modifications in addition to checks.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/nfsd/nfsproc.c')
-rw-r--r-- | fs/nfsd/nfsproc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index e9214768cde9..08188743db53 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -74,10 +74,10 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, | |||
74 | * which only requires access, and "set-[ac]time-to-X" which | 74 | * which only requires access, and "set-[ac]time-to-X" which |
75 | * requires ownership. | 75 | * requires ownership. |
76 | * So if it looks like it might be "set both to the same time which | 76 | * So if it looks like it might be "set both to the same time which |
77 | * is close to now", and if inode_change_ok fails, then we | 77 | * is close to now", and if setattr_prepare fails, then we |
78 | * convert to "set to now" instead of "set to explicit time" | 78 | * convert to "set to now" instead of "set to explicit time" |
79 | * | 79 | * |
80 | * We only call inode_change_ok as the last test as technically | 80 | * We only call setattr_prepare as the last test as technically |
81 | * it is not an interface that we should be using. | 81 | * it is not an interface that we should be using. |
82 | */ | 82 | */ |
83 | #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) | 83 | #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) |
@@ -92,17 +92,15 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, | |||
92 | * request is. We require it be within 30 minutes of now. | 92 | * request is. We require it be within 30 minutes of now. |
93 | */ | 93 | */ |
94 | time_t delta = iap->ia_atime.tv_sec - get_seconds(); | 94 | time_t delta = iap->ia_atime.tv_sec - get_seconds(); |
95 | struct inode *inode; | ||
96 | 95 | ||
97 | nfserr = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP); | 96 | nfserr = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP); |
98 | if (nfserr) | 97 | if (nfserr) |
99 | goto done; | 98 | goto done; |
100 | inode = d_inode(fhp->fh_dentry); | ||
101 | 99 | ||
102 | if (delta < 0) | 100 | if (delta < 0) |
103 | delta = -delta; | 101 | delta = -delta; |
104 | if (delta < MAX_TOUCH_TIME_ERROR && | 102 | if (delta < MAX_TOUCH_TIME_ERROR && |
105 | inode_change_ok(inode, iap) != 0) { | 103 | setattr_prepare(fhp->fh_dentry, iap) != 0) { |
106 | /* | 104 | /* |
107 | * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. | 105 | * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. |
108 | * This will cause notify_change to set these times | 106 | * This will cause notify_change to set these times |