diff options
-rw-r--r-- | fs/nfsd/nfs4state.c | 15 | ||||
-rw-r--r-- | include/linux/sunrpc/cache.h | 22 |
2 files changed, 25 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 43f42290e5df..5e609b17ada4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -282,19 +282,14 @@ static unsigned int file_hashval(struct inode *ino) | |||
282 | 282 | ||
283 | static struct hlist_head file_hashtbl[FILE_HASH_SIZE]; | 283 | static struct hlist_head file_hashtbl[FILE_HASH_SIZE]; |
284 | 284 | ||
285 | static void __nfs4_file_get_access(struct nfs4_file *fp, int oflag) | ||
286 | { | ||
287 | WARN_ON_ONCE(!(fp->fi_fds[oflag] || fp->fi_fds[O_RDWR])); | ||
288 | atomic_inc(&fp->fi_access[oflag]); | ||
289 | } | ||
290 | |||
291 | static void nfs4_file_get_access(struct nfs4_file *fp, int oflag) | 285 | static void nfs4_file_get_access(struct nfs4_file *fp, int oflag) |
292 | { | 286 | { |
287 | WARN_ON_ONCE(!fp->fi_fds[oflag]); | ||
293 | if (oflag == O_RDWR) { | 288 | if (oflag == O_RDWR) { |
294 | __nfs4_file_get_access(fp, O_RDONLY); | 289 | atomic_inc(&fp->fi_access[O_RDONLY]); |
295 | __nfs4_file_get_access(fp, O_WRONLY); | 290 | atomic_inc(&fp->fi_access[O_WRONLY]); |
296 | } else | 291 | } else |
297 | __nfs4_file_get_access(fp, oflag); | 292 | atomic_inc(&fp->fi_access[oflag]); |
298 | } | 293 | } |
299 | 294 | ||
300 | static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag) | 295 | static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag) |
@@ -3035,7 +3030,7 @@ static int nfs4_setlease(struct nfs4_delegation *dp) | |||
3035 | if (status) { | 3030 | if (status) { |
3036 | list_del_init(&dp->dl_perclnt); | 3031 | list_del_init(&dp->dl_perclnt); |
3037 | locks_free_lock(fl); | 3032 | locks_free_lock(fl); |
3038 | return -ENOMEM; | 3033 | return status; |
3039 | } | 3034 | } |
3040 | fp->fi_lease = fl; | 3035 | fp->fi_lease = fl; |
3041 | fp->fi_deleg_file = get_file(fl->fl_file); | 3036 | fp->fi_deleg_file = get_file(fl->fl_file); |
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 6ce690de447f..437ddb6c4aef 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
@@ -264,12 +264,30 @@ static inline int get_uint(char **bpp, unsigned int *anint) | |||
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | 266 | ||
267 | static inline int get_time(char **bpp, time_t *time) | ||
268 | { | ||
269 | char buf[50]; | ||
270 | long long ll; | ||
271 | int len = qword_get(bpp, buf, sizeof(buf)); | ||
272 | |||
273 | if (len < 0) | ||
274 | return -EINVAL; | ||
275 | if (len == 0) | ||
276 | return -ENOENT; | ||
277 | |||
278 | if (kstrtoll(buf, 0, &ll)) | ||
279 | return -EINVAL; | ||
280 | |||
281 | *time = (time_t)ll; | ||
282 | return 0; | ||
283 | } | ||
284 | |||
267 | static inline time_t get_expiry(char **bpp) | 285 | static inline time_t get_expiry(char **bpp) |
268 | { | 286 | { |
269 | int rv; | 287 | time_t rv; |
270 | struct timespec boot; | 288 | struct timespec boot; |
271 | 289 | ||
272 | if (get_int(bpp, &rv)) | 290 | if (get_time(bpp, &rv)) |
273 | return 0; | 291 | return 0; |
274 | if (rv < 0) | 292 | if (rv < 0) |
275 | return 0; | 293 | return 0; |