diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-25 12:25:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-25 12:25:12 -0400 |
commit | 844fdd9ac1cdd756f5bd233f302ecabb27dd387a (patch) | |
tree | f0175c8573aafdebee6c8fa43ca27ccf265a6b01 | |
parent | c4052ba9dad9cc86cb3a1f0f8cb032514fa414be (diff) | |
parent | e49dbbf3e770aa590a8a464ac4978a09027060b9 (diff) |
Merge branch 'for-3.9' of git://linux-nfs.org/~bfields/linux
Pull nfsd bugfixes from J Bruce Fields:
"Fixes for a couple mistakes in the new DRC code. And thanks to Kent
Overstreet for noticing we've been sync'ing the wrong range on stable
writes since 3.8."
* 'for-3.9' of git://linux-nfs.org/~bfields/linux:
nfsd: fix bad offset use
nfsd: fix startup order in nfsd_reply_cache_init
nfsd: only unhash DRC entries that are in the hashtable
-rw-r--r-- | fs/nfsd/nfscache.c | 11 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 62c1ee128aeb..ca05f6dc3544 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -102,7 +102,8 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp) | |||
102 | { | 102 | { |
103 | if (rp->c_type == RC_REPLBUFF) | 103 | if (rp->c_type == RC_REPLBUFF) |
104 | kfree(rp->c_replvec.iov_base); | 104 | kfree(rp->c_replvec.iov_base); |
105 | hlist_del(&rp->c_hash); | 105 | if (!hlist_unhashed(&rp->c_hash)) |
106 | hlist_del(&rp->c_hash); | ||
106 | list_del(&rp->c_lru); | 107 | list_del(&rp->c_lru); |
107 | --num_drc_entries; | 108 | --num_drc_entries; |
108 | kmem_cache_free(drc_slab, rp); | 109 | kmem_cache_free(drc_slab, rp); |
@@ -118,6 +119,10 @@ nfsd_reply_cache_free(struct svc_cacherep *rp) | |||
118 | 119 | ||
119 | int nfsd_reply_cache_init(void) | 120 | int nfsd_reply_cache_init(void) |
120 | { | 121 | { |
122 | INIT_LIST_HEAD(&lru_head); | ||
123 | max_drc_entries = nfsd_cache_size_limit(); | ||
124 | num_drc_entries = 0; | ||
125 | |||
121 | register_shrinker(&nfsd_reply_cache_shrinker); | 126 | register_shrinker(&nfsd_reply_cache_shrinker); |
122 | drc_slab = kmem_cache_create("nfsd_drc", sizeof(struct svc_cacherep), | 127 | drc_slab = kmem_cache_create("nfsd_drc", sizeof(struct svc_cacherep), |
123 | 0, 0, NULL); | 128 | 0, 0, NULL); |
@@ -128,10 +133,6 @@ int nfsd_reply_cache_init(void) | |||
128 | if (!cache_hash) | 133 | if (!cache_hash) |
129 | goto out_nomem; | 134 | goto out_nomem; |
130 | 135 | ||
131 | INIT_LIST_HEAD(&lru_head); | ||
132 | max_drc_entries = nfsd_cache_size_limit(); | ||
133 | num_drc_entries = 0; | ||
134 | |||
135 | return 0; | 136 | return 0; |
136 | out_nomem: | 137 | out_nomem: |
137 | printk(KERN_ERR "nfsd: failed to allocate reply cache\n"); | 138 | printk(KERN_ERR "nfsd: failed to allocate reply cache\n"); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 2a7eb536de0b..2b2e2396a869 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1013,6 +1013,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1013 | int host_err; | 1013 | int host_err; |
1014 | int stable = *stablep; | 1014 | int stable = *stablep; |
1015 | int use_wgather; | 1015 | int use_wgather; |
1016 | loff_t pos = offset; | ||
1016 | 1017 | ||
1017 | dentry = file->f_path.dentry; | 1018 | dentry = file->f_path.dentry; |
1018 | inode = dentry->d_inode; | 1019 | inode = dentry->d_inode; |
@@ -1025,7 +1026,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1025 | 1026 | ||
1026 | /* Write the data. */ | 1027 | /* Write the data. */ |
1027 | oldfs = get_fs(); set_fs(KERNEL_DS); | 1028 | oldfs = get_fs(); set_fs(KERNEL_DS); |
1028 | host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); | 1029 | host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos); |
1029 | set_fs(oldfs); | 1030 | set_fs(oldfs); |
1030 | if (host_err < 0) | 1031 | if (host_err < 0) |
1031 | goto out_nfserr; | 1032 | goto out_nfserr; |