diff options
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r-- | fs/nfsd/vfs.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 84d770be056e..92de3747ea8b 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -302,42 +302,6 @@ commit_metadata(struct svc_fh *fhp) | |||
302 | static void | 302 | static void |
303 | nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap) | 303 | nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap) |
304 | { | 304 | { |
305 | /* | ||
306 | * NFSv2 does not differentiate between "set-[ac]time-to-now" | ||
307 | * which only requires access, and "set-[ac]time-to-X" which | ||
308 | * requires ownership. | ||
309 | * So if it looks like it might be "set both to the same time which | ||
310 | * is close to now", and if inode_change_ok fails, then we | ||
311 | * convert to "set to now" instead of "set to explicit time" | ||
312 | * | ||
313 | * We only call inode_change_ok as the last test as technically | ||
314 | * it is not an interface that we should be using. | ||
315 | */ | ||
316 | #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) | ||
317 | #define MAX_TOUCH_TIME_ERROR (30*60) | ||
318 | if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET && | ||
319 | iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec) { | ||
320 | /* | ||
321 | * Looks probable. | ||
322 | * | ||
323 | * Now just make sure time is in the right ballpark. | ||
324 | * Solaris, at least, doesn't seem to care what the time | ||
325 | * request is. We require it be within 30 minutes of now. | ||
326 | */ | ||
327 | time_t delta = iap->ia_atime.tv_sec - get_seconds(); | ||
328 | if (delta < 0) | ||
329 | delta = -delta; | ||
330 | if (delta < MAX_TOUCH_TIME_ERROR && | ||
331 | inode_change_ok(inode, iap) != 0) { | ||
332 | /* | ||
333 | * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. | ||
334 | * This will cause notify_change to set these times | ||
335 | * to "now" | ||
336 | */ | ||
337 | iap->ia_valid &= ~BOTH_TIME_SET; | ||
338 | } | ||
339 | } | ||
340 | |||
341 | /* sanitize the mode change */ | 305 | /* sanitize the mode change */ |
342 | if (iap->ia_valid & ATTR_MODE) { | 306 | if (iap->ia_valid & ATTR_MODE) { |
343 | iap->ia_mode &= S_IALLUGO; | 307 | iap->ia_mode &= S_IALLUGO; |