diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-03-07 10:26:25 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2007-10-09 18:31:56 -0400 |
commit | 9c85fca56b569dfba1f10ae12ce425c0e678df83 (patch) | |
tree | 588274c4216818f671ac47d804e830ae10f0d6e5 /fs/nfsd/vfs.c | |
parent | dca1dd30ce0a6234acc751bb90efba1b49079669 (diff) |
nfsd: fix horrible indentation in nfsd_setattr
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Acked-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 7867151ebb8..cec78c82b1f 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -295,7 +295,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
295 | if (!iap->ia_valid) | 295 | if (!iap->ia_valid) |
296 | goto out; | 296 | goto out; |
297 | 297 | ||
298 | /* NFSv2 does not differentiate between "set-[ac]time-to-now" | 298 | /* |
299 | * NFSv2 does not differentiate between "set-[ac]time-to-now" | ||
299 | * which only requires access, and "set-[ac]time-to-X" which | 300 | * which only requires access, and "set-[ac]time-to-X" which |
300 | * requires ownership. | 301 | * requires ownership. |
301 | * So if it looks like it might be "set both to the same time which | 302 | * So if it looks like it might be "set both to the same time which |
@@ -308,25 +309,33 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
308 | */ | 309 | */ |
309 | #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) | 310 | #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) |
310 | #define MAX_TOUCH_TIME_ERROR (30*60) | 311 | #define MAX_TOUCH_TIME_ERROR (30*60) |
311 | if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET | 312 | if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET && |
312 | && iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec | 313 | iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec) { |
313 | ) { | 314 | /* |
314 | /* Looks probable. Now just make sure time is in the right ballpark. | 315 | * Looks probable. |
315 | * Solaris, at least, doesn't seem to care what the time request is. | 316 | * |
316 | * We require it be within 30 minutes of now. | 317 | * Now just make sure time is in the right ballpark. |
317 | */ | 318 | * Solaris, at least, doesn't seem to care what the time |
318 | time_t delta = iap->ia_atime.tv_sec - get_seconds(); | 319 | * request is. We require it be within 30 minutes of now. |
319 | if (delta<0) delta = -delta; | ||
320 | if (delta < MAX_TOUCH_TIME_ERROR && | ||
321 | inode_change_ok(inode, iap) != 0) { | ||
322 | /* turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME | ||
323 | * this will cause notify_change to set these times to "now" | ||
324 | */ | 320 | */ |
325 | iap->ia_valid &= ~BOTH_TIME_SET; | 321 | time_t delta = iap->ia_atime.tv_sec - get_seconds(); |
326 | } | 322 | if (delta < 0) |
323 | delta = -delta; | ||
324 | if (delta < MAX_TOUCH_TIME_ERROR && | ||
325 | inode_change_ok(inode, iap) != 0) { | ||
326 | /* | ||
327 | * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. | ||
328 | * This will cause notify_change to set these times | ||
329 | * to "now" | ||
330 | */ | ||
331 | iap->ia_valid &= ~BOTH_TIME_SET; | ||
332 | } | ||
327 | } | 333 | } |
328 | 334 | ||
329 | /* The size case is special. It changes the file as well as the attributes. */ | 335 | /* |
336 | * The size case is special. | ||
337 | * It changes the file as well as the attributes. | ||
338 | */ | ||
330 | if (iap->ia_valid & ATTR_SIZE) { | 339 | if (iap->ia_valid & ATTR_SIZE) { |
331 | if (iap->ia_size < inode->i_size) { | 340 | if (iap->ia_size < inode->i_size) { |
332 | err = nfsd_permission(rqstp, fhp->fh_export, dentry, MAY_TRUNC|MAY_OWNER_OVERRIDE); | 341 | err = nfsd_permission(rqstp, fhp->fh_export, dentry, MAY_TRUNC|MAY_OWNER_OVERRIDE); |