diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/client.c | 1 | ||||
-rw-r--r-- | fs/nfs/dir.c | 8 | ||||
-rw-r--r-- | fs/nfs/getroot.c | 6 | ||||
-rw-r--r-- | fs/nfs/idmap.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 134 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 5 |
7 files changed, 71 insertions, 86 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 31778f74357d..d4f772ebd1ef 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/inet.h> | 36 | #include <linux/inet.h> |
37 | #include <linux/in6.h> | 37 | #include <linux/in6.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/idr.h> | ||
39 | #include <net/ipv6.h> | 40 | #include <net/ipv6.h> |
40 | #include <linux/nfs_xdr.h> | 41 | #include <linux/nfs_xdr.h> |
41 | #include <linux/sunrpc/bc_xprt.h> | 42 | #include <linux/sunrpc/bc_xprt.h> |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index fd9a872fada0..32aa6917265a 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -260,10 +260,10 @@ void nfs_readdir_clear_array(struct page *page) | |||
260 | struct nfs_cache_array *array; | 260 | struct nfs_cache_array *array; |
261 | int i; | 261 | int i; |
262 | 262 | ||
263 | array = kmap_atomic(page, KM_USER0); | 263 | array = kmap_atomic(page); |
264 | for (i = 0; i < array->size; i++) | 264 | for (i = 0; i < array->size; i++) |
265 | kfree(array->array[i].string.name); | 265 | kfree(array->array[i].string.name); |
266 | kunmap_atomic(array, KM_USER0); | 266 | kunmap_atomic(array); |
267 | } | 267 | } |
268 | 268 | ||
269 | /* | 269 | /* |
@@ -1870,11 +1870,11 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym | |||
1870 | if (!page) | 1870 | if (!page) |
1871 | return -ENOMEM; | 1871 | return -ENOMEM; |
1872 | 1872 | ||
1873 | kaddr = kmap_atomic(page, KM_USER0); | 1873 | kaddr = kmap_atomic(page); |
1874 | memcpy(kaddr, symname, pathlen); | 1874 | memcpy(kaddr, symname, pathlen); |
1875 | if (pathlen < PAGE_SIZE) | 1875 | if (pathlen < PAGE_SIZE) |
1876 | memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen); | 1876 | memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen); |
1877 | kunmap_atomic(kaddr, KM_USER0); | 1877 | kunmap_atomic(kaddr); |
1878 | 1878 | ||
1879 | error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr); | 1879 | error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr); |
1880 | if (error != 0) { | 1880 | if (error != 0) { |
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index dcb61548887f..801d6d830787 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c | |||
@@ -49,11 +49,9 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i | |||
49 | { | 49 | { |
50 | /* The mntroot acts as the dummy root dentry for this superblock */ | 50 | /* The mntroot acts as the dummy root dentry for this superblock */ |
51 | if (sb->s_root == NULL) { | 51 | if (sb->s_root == NULL) { |
52 | sb->s_root = d_alloc_root(inode); | 52 | sb->s_root = d_make_root(inode); |
53 | if (sb->s_root == NULL) { | 53 | if (sb->s_root == NULL) |
54 | iput(inode); | ||
55 | return -ENOMEM; | 54 | return -ENOMEM; |
56 | } | ||
57 | ihold(inode); | 55 | ihold(inode); |
58 | /* | 56 | /* |
59 | * Ensure that this dentry is invisible to d_find_alias(). | 57 | * Ensure that this dentry is invisible to d_find_alias(). |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index 2c05f1991e1e..a1bbf7780dfc 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -198,6 +198,7 @@ int nfs_idmap_init(void) | |||
198 | if (ret < 0) | 198 | if (ret < 0) |
199 | goto failed_put_key; | 199 | goto failed_put_key; |
200 | 200 | ||
201 | set_bit(KEY_FLAG_ROOT_CAN_CLEAR, &keyring->flags); | ||
201 | cred->thread_keyring = keyring; | 202 | cred->thread_keyring = keyring; |
202 | cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING; | 203 | cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING; |
203 | id_resolver_cache = cred; | 204 | id_resolver_cache = cred; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f0c849c98fe4..caf92d05c3a9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -193,7 +193,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent | |||
193 | * when talking to the server, we always send cookie 0 | 193 | * when talking to the server, we always send cookie 0 |
194 | * instead of 1 or 2. | 194 | * instead of 1 or 2. |
195 | */ | 195 | */ |
196 | start = p = kmap_atomic(*readdir->pages, KM_USER0); | 196 | start = p = kmap_atomic(*readdir->pages); |
197 | 197 | ||
198 | if (cookie == 0) { | 198 | if (cookie == 0) { |
199 | *p++ = xdr_one; /* next */ | 199 | *p++ = xdr_one; /* next */ |
@@ -221,7 +221,7 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent | |||
221 | 221 | ||
222 | readdir->pgbase = (char *)p - (char *)start; | 222 | readdir->pgbase = (char *)p - (char *)start; |
223 | readdir->count -= readdir->pgbase; | 223 | readdir->count -= readdir->pgbase; |
224 | kunmap_atomic(start, KM_USER0); | 224 | kunmap_atomic(start); |
225 | } | 225 | } |
226 | 226 | ||
227 | static int nfs4_wait_clnt_recover(struct nfs_client *clp) | 227 | static int nfs4_wait_clnt_recover(struct nfs_client *clp) |
@@ -3575,8 +3575,8 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
3575 | } | 3575 | } |
3576 | if (npages > 1) { | 3576 | if (npages > 1) { |
3577 | /* for decoding across pages */ | 3577 | /* for decoding across pages */ |
3578 | args.acl_scratch = alloc_page(GFP_KERNEL); | 3578 | res.acl_scratch = alloc_page(GFP_KERNEL); |
3579 | if (!args.acl_scratch) | 3579 | if (!res.acl_scratch) |
3580 | goto out_free; | 3580 | goto out_free; |
3581 | } | 3581 | } |
3582 | args.acl_len = npages * PAGE_SIZE; | 3582 | args.acl_len = npages * PAGE_SIZE; |
@@ -3612,8 +3612,8 @@ out_free: | |||
3612 | for (i = 0; i < npages; i++) | 3612 | for (i = 0; i < npages; i++) |
3613 | if (pages[i]) | 3613 | if (pages[i]) |
3614 | __free_page(pages[i]); | 3614 | __free_page(pages[i]); |
3615 | if (args.acl_scratch) | 3615 | if (res.acl_scratch) |
3616 | __free_page(args.acl_scratch); | 3616 | __free_page(res.acl_scratch); |
3617 | return ret; | 3617 | return ret; |
3618 | } | 3618 | } |
3619 | 3619 | ||
@@ -4883,8 +4883,10 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) | |||
4883 | clp->cl_rpcclient->cl_auth->au_flavor); | 4883 | clp->cl_rpcclient->cl_auth->au_flavor); |
4884 | 4884 | ||
4885 | res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); | 4885 | res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); |
4886 | if (unlikely(!res.server_scope)) | 4886 | if (unlikely(!res.server_scope)) { |
4887 | return -ENOMEM; | 4887 | status = -ENOMEM; |
4888 | goto out; | ||
4889 | } | ||
4888 | 4890 | ||
4889 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); | 4891 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
4890 | if (!status) | 4892 | if (!status) |
@@ -4901,12 +4903,13 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) | |||
4901 | clp->server_scope = NULL; | 4903 | clp->server_scope = NULL; |
4902 | } | 4904 | } |
4903 | 4905 | ||
4904 | if (!clp->server_scope) | 4906 | if (!clp->server_scope) { |
4905 | clp->server_scope = res.server_scope; | 4907 | clp->server_scope = res.server_scope; |
4906 | else | 4908 | goto out; |
4907 | kfree(res.server_scope); | 4909 | } |
4908 | } | 4910 | } |
4909 | 4911 | kfree(res.server_scope); | |
4912 | out: | ||
4910 | dprintk("<-- %s status= %d\n", __func__, status); | 4913 | dprintk("<-- %s status= %d\n", __func__, status); |
4911 | return status; | 4914 | return status; |
4912 | } | 4915 | } |
@@ -5008,37 +5011,53 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo) | |||
5008 | return status; | 5011 | return status; |
5009 | } | 5012 | } |
5010 | 5013 | ||
5014 | static struct nfs4_slot *nfs4_alloc_slots(u32 max_slots, gfp_t gfp_flags) | ||
5015 | { | ||
5016 | return kcalloc(max_slots, sizeof(struct nfs4_slot), gfp_flags); | ||
5017 | } | ||
5018 | |||
5019 | static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl, | ||
5020 | struct nfs4_slot *new, | ||
5021 | u32 max_slots, | ||
5022 | u32 ivalue) | ||
5023 | { | ||
5024 | struct nfs4_slot *old = NULL; | ||
5025 | u32 i; | ||
5026 | |||
5027 | spin_lock(&tbl->slot_tbl_lock); | ||
5028 | if (new) { | ||
5029 | old = tbl->slots; | ||
5030 | tbl->slots = new; | ||
5031 | tbl->max_slots = max_slots; | ||
5032 | } | ||
5033 | tbl->highest_used_slotid = -1; /* no slot is currently used */ | ||
5034 | for (i = 0; i < tbl->max_slots; i++) | ||
5035 | tbl->slots[i].seq_nr = ivalue; | ||
5036 | spin_unlock(&tbl->slot_tbl_lock); | ||
5037 | kfree(old); | ||
5038 | } | ||
5039 | |||
5011 | /* | 5040 | /* |
5012 | * Reset a slot table | 5041 | * (re)Initialise a slot table |
5013 | */ | 5042 | */ |
5014 | static int nfs4_reset_slot_table(struct nfs4_slot_table *tbl, u32 max_reqs, | 5043 | static int nfs4_realloc_slot_table(struct nfs4_slot_table *tbl, u32 max_reqs, |
5015 | int ivalue) | 5044 | u32 ivalue) |
5016 | { | 5045 | { |
5017 | struct nfs4_slot *new = NULL; | 5046 | struct nfs4_slot *new = NULL; |
5018 | int i; | 5047 | int ret = -ENOMEM; |
5019 | int ret = 0; | ||
5020 | 5048 | ||
5021 | dprintk("--> %s: max_reqs=%u, tbl->max_slots %d\n", __func__, | 5049 | dprintk("--> %s: max_reqs=%u, tbl->max_slots %d\n", __func__, |
5022 | max_reqs, tbl->max_slots); | 5050 | max_reqs, tbl->max_slots); |
5023 | 5051 | ||
5024 | /* Does the newly negotiated max_reqs match the existing slot table? */ | 5052 | /* Does the newly negotiated max_reqs match the existing slot table? */ |
5025 | if (max_reqs != tbl->max_slots) { | 5053 | if (max_reqs != tbl->max_slots) { |
5026 | ret = -ENOMEM; | 5054 | new = nfs4_alloc_slots(max_reqs, GFP_NOFS); |
5027 | new = kmalloc(max_reqs * sizeof(struct nfs4_slot), | ||
5028 | GFP_NOFS); | ||
5029 | if (!new) | 5055 | if (!new) |
5030 | goto out; | 5056 | goto out; |
5031 | ret = 0; | ||
5032 | kfree(tbl->slots); | ||
5033 | } | 5057 | } |
5034 | spin_lock(&tbl->slot_tbl_lock); | 5058 | ret = 0; |
5035 | if (new) { | 5059 | |
5036 | tbl->slots = new; | 5060 | nfs4_add_and_init_slots(tbl, new, max_reqs, ivalue); |
5037 | tbl->max_slots = max_reqs; | ||
5038 | } | ||
5039 | for (i = 0; i < tbl->max_slots; ++i) | ||
5040 | tbl->slots[i].seq_nr = ivalue; | ||
5041 | spin_unlock(&tbl->slot_tbl_lock); | ||
5042 | dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, | 5061 | dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, |
5043 | tbl, tbl->slots, tbl->max_slots); | 5062 | tbl, tbl->slots, tbl->max_slots); |
5044 | out: | 5063 | out: |
@@ -5061,36 +5080,6 @@ static void nfs4_destroy_slot_tables(struct nfs4_session *session) | |||
5061 | } | 5080 | } |
5062 | 5081 | ||
5063 | /* | 5082 | /* |
5064 | * Initialize slot table | ||
5065 | */ | ||
5066 | static int nfs4_init_slot_table(struct nfs4_slot_table *tbl, | ||
5067 | int max_slots, int ivalue) | ||
5068 | { | ||
5069 | struct nfs4_slot *slot; | ||
5070 | int ret = -ENOMEM; | ||
5071 | |||
5072 | BUG_ON(max_slots > NFS4_MAX_SLOT_TABLE); | ||
5073 | |||
5074 | dprintk("--> %s: max_reqs=%u\n", __func__, max_slots); | ||
5075 | |||
5076 | slot = kcalloc(max_slots, sizeof(struct nfs4_slot), GFP_NOFS); | ||
5077 | if (!slot) | ||
5078 | goto out; | ||
5079 | ret = 0; | ||
5080 | |||
5081 | spin_lock(&tbl->slot_tbl_lock); | ||
5082 | tbl->max_slots = max_slots; | ||
5083 | tbl->slots = slot; | ||
5084 | tbl->highest_used_slotid = -1; /* no slot is currently used */ | ||
5085 | spin_unlock(&tbl->slot_tbl_lock); | ||
5086 | dprintk("%s: tbl=%p slots=%p max_slots=%d\n", __func__, | ||
5087 | tbl, tbl->slots, tbl->max_slots); | ||
5088 | out: | ||
5089 | dprintk("<-- %s: return %d\n", __func__, ret); | ||
5090 | return ret; | ||
5091 | } | ||
5092 | |||
5093 | /* | ||
5094 | * Initialize or reset the forechannel and backchannel tables | 5083 | * Initialize or reset the forechannel and backchannel tables |
5095 | */ | 5084 | */ |
5096 | static int nfs4_setup_session_slot_tables(struct nfs4_session *ses) | 5085 | static int nfs4_setup_session_slot_tables(struct nfs4_session *ses) |
@@ -5101,25 +5090,16 @@ static int nfs4_setup_session_slot_tables(struct nfs4_session *ses) | |||
5101 | dprintk("--> %s\n", __func__); | 5090 | dprintk("--> %s\n", __func__); |
5102 | /* Fore channel */ | 5091 | /* Fore channel */ |
5103 | tbl = &ses->fc_slot_table; | 5092 | tbl = &ses->fc_slot_table; |
5104 | if (tbl->slots == NULL) { | 5093 | status = nfs4_realloc_slot_table(tbl, ses->fc_attrs.max_reqs, 1); |
5105 | status = nfs4_init_slot_table(tbl, ses->fc_attrs.max_reqs, 1); | 5094 | if (status) /* -ENOMEM */ |
5106 | if (status) /* -ENOMEM */ | 5095 | return status; |
5107 | return status; | ||
5108 | } else { | ||
5109 | status = nfs4_reset_slot_table(tbl, ses->fc_attrs.max_reqs, 1); | ||
5110 | if (status) | ||
5111 | return status; | ||
5112 | } | ||
5113 | /* Back channel */ | 5096 | /* Back channel */ |
5114 | tbl = &ses->bc_slot_table; | 5097 | tbl = &ses->bc_slot_table; |
5115 | if (tbl->slots == NULL) { | 5098 | status = nfs4_realloc_slot_table(tbl, ses->bc_attrs.max_reqs, 0); |
5116 | status = nfs4_init_slot_table(tbl, ses->bc_attrs.max_reqs, 0); | 5099 | if (status && tbl->slots == NULL) |
5117 | if (status) | 5100 | /* Fore and back channel share a connection so get |
5118 | /* Fore and back channel share a connection so get | 5101 | * both slot tables or neither */ |
5119 | * both slot tables or neither */ | 5102 | nfs4_destroy_slot_tables(ses); |
5120 | nfs4_destroy_slot_tables(ses); | ||
5121 | } else | ||
5122 | status = nfs4_reset_slot_table(tbl, ses->bc_attrs.max_reqs, 0); | ||
5123 | return status; | 5103 | return status; |
5124 | } | 5104 | } |
5125 | 5105 | ||
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index a53f33b4ac3a..45392032e7bd 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1132,6 +1132,8 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 | |||
1132 | { | 1132 | { |
1133 | struct nfs_client *clp = server->nfs_client; | 1133 | struct nfs_client *clp = server->nfs_client; |
1134 | 1134 | ||
1135 | if (test_and_clear_bit(NFS_DELEGATED_STATE, &state->flags)) | ||
1136 | nfs_async_inode_return_delegation(state->inode, &state->stateid); | ||
1135 | nfs4_state_mark_reclaim_nograce(clp, state); | 1137 | nfs4_state_mark_reclaim_nograce(clp, state); |
1136 | nfs4_schedule_state_manager(clp); | 1138 | nfs4_schedule_state_manager(clp); |
1137 | } | 1139 | } |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 95e92e438407..33bd8d0f745d 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -2522,7 +2522,6 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
2522 | 2522 | ||
2523 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, | 2523 | xdr_inline_pages(&req->rq_rcv_buf, replen << 2, |
2524 | args->acl_pages, args->acl_pgbase, args->acl_len); | 2524 | args->acl_pages, args->acl_pgbase, args->acl_len); |
2525 | xdr_set_scratch_buffer(xdr, page_address(args->acl_scratch), PAGE_SIZE); | ||
2526 | 2525 | ||
2527 | encode_nops(&hdr); | 2526 | encode_nops(&hdr); |
2528 | } | 2527 | } |
@@ -6032,6 +6031,10 @@ nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr, | |||
6032 | struct compound_hdr hdr; | 6031 | struct compound_hdr hdr; |
6033 | int status; | 6032 | int status; |
6034 | 6033 | ||
6034 | if (res->acl_scratch != NULL) { | ||
6035 | void *p = page_address(res->acl_scratch); | ||
6036 | xdr_set_scratch_buffer(xdr, p, PAGE_SIZE); | ||
6037 | } | ||
6035 | status = decode_compound_hdr(xdr, &hdr); | 6038 | status = decode_compound_hdr(xdr, &hdr); |
6036 | if (status) | 6039 | if (status) |
6037 | goto out; | 6040 | goto out; |