diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-23 01:47:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-23 01:47:38 -0400 |
commit | 344ba37bdc299660e1b1693b6999e5fe116893e1 (patch) | |
tree | eaff91d98d4b0d889e25c8201673c4dbaf6e627b /fs | |
parent | c52f1dd5292e87f77380624f67da6eaf5dd2df3a (diff) | |
parent | e9b7e91745fa9df94900c8ab08e633f336686098 (diff) |
Merge tag 'nfs-for-3.7-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfixes from Trond Myklebust:
- Do not call pnfs_return_layout() from an rpciod context
- nfs4_ds_disconnect can cause Oopses. Kill it...
- Fix the return value for nfs_callback_start_svc
- Fix a number of compile warnings
* tag 'nfs-for-3.7-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
NFSv4: Fix the return value for nfs_callback_start_svc
NFSv4.1: Declare osd_pri_2_pnfs_err(), objio_init_read/write to be static
NFSv4: fs/nfs/nfs4getroot.c needs to include "internal.h"
NFSv4.1: Use kcalloc() to allocate zeroed arrays instead of kzalloc()
NFSv4.1: Do not call pnfs_return_layout() from an rpciod context
NFSv4.1: Kill nfs4_ds_disconnect()
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/callback.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 21 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayout.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayoutdev.c | 22 | ||||
-rw-r--r-- | fs/nfs/nfs4getroot.c | 1 | ||||
-rw-r--r-- | fs/nfs/objlayout/objio_osd.c | 6 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 1 |
7 files changed, 22 insertions, 32 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 9a521fb39869..5088b57b078a 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -241,7 +241,7 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt, | |||
241 | svc_exit_thread(cb_info->rqst); | 241 | svc_exit_thread(cb_info->rqst); |
242 | cb_info->rqst = NULL; | 242 | cb_info->rqst = NULL; |
243 | cb_info->task = NULL; | 243 | cb_info->task = NULL; |
244 | return PTR_ERR(cb_info->task); | 244 | return ret; |
245 | } | 245 | } |
246 | dprintk("nfs_callback_up: service started\n"); | 246 | dprintk("nfs_callback_up: service started\n"); |
247 | return 0; | 247 | return 0; |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 52d847212066..2e45fd9c02a3 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -122,12 +122,21 @@ static void filelayout_reset_read(struct nfs_read_data *data) | |||
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | static void filelayout_fenceme(struct inode *inode, struct pnfs_layout_hdr *lo) | ||
126 | { | ||
127 | if (!test_and_clear_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) | ||
128 | return; | ||
129 | clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags); | ||
130 | pnfs_return_layout(inode); | ||
131 | } | ||
132 | |||
125 | static int filelayout_async_handle_error(struct rpc_task *task, | 133 | static int filelayout_async_handle_error(struct rpc_task *task, |
126 | struct nfs4_state *state, | 134 | struct nfs4_state *state, |
127 | struct nfs_client *clp, | 135 | struct nfs_client *clp, |
128 | struct pnfs_layout_segment *lseg) | 136 | struct pnfs_layout_segment *lseg) |
129 | { | 137 | { |
130 | struct inode *inode = lseg->pls_layout->plh_inode; | 138 | struct pnfs_layout_hdr *lo = lseg->pls_layout; |
139 | struct inode *inode = lo->plh_inode; | ||
131 | struct nfs_server *mds_server = NFS_SERVER(inode); | 140 | struct nfs_server *mds_server = NFS_SERVER(inode); |
132 | struct nfs4_deviceid_node *devid = FILELAYOUT_DEVID_NODE(lseg); | 141 | struct nfs4_deviceid_node *devid = FILELAYOUT_DEVID_NODE(lseg); |
133 | struct nfs_client *mds_client = mds_server->nfs_client; | 142 | struct nfs_client *mds_client = mds_server->nfs_client; |
@@ -204,10 +213,8 @@ static int filelayout_async_handle_error(struct rpc_task *task, | |||
204 | dprintk("%s DS connection error %d\n", __func__, | 213 | dprintk("%s DS connection error %d\n", __func__, |
205 | task->tk_status); | 214 | task->tk_status); |
206 | nfs4_mark_deviceid_unavailable(devid); | 215 | nfs4_mark_deviceid_unavailable(devid); |
207 | clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags); | 216 | set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags); |
208 | _pnfs_return_layout(inode); | ||
209 | rpc_wake_up(&tbl->slot_tbl_waitq); | 217 | rpc_wake_up(&tbl->slot_tbl_waitq); |
210 | nfs4_ds_disconnect(clp); | ||
211 | /* fall through */ | 218 | /* fall through */ |
212 | default: | 219 | default: |
213 | reset: | 220 | reset: |
@@ -331,7 +338,9 @@ static void filelayout_read_count_stats(struct rpc_task *task, void *data) | |||
331 | static void filelayout_read_release(void *data) | 338 | static void filelayout_read_release(void *data) |
332 | { | 339 | { |
333 | struct nfs_read_data *rdata = data; | 340 | struct nfs_read_data *rdata = data; |
341 | struct pnfs_layout_hdr *lo = rdata->header->lseg->pls_layout; | ||
334 | 342 | ||
343 | filelayout_fenceme(lo->plh_inode, lo); | ||
335 | nfs_put_client(rdata->ds_clp); | 344 | nfs_put_client(rdata->ds_clp); |
336 | rdata->header->mds_ops->rpc_release(data); | 345 | rdata->header->mds_ops->rpc_release(data); |
337 | } | 346 | } |
@@ -429,7 +438,9 @@ static void filelayout_write_count_stats(struct rpc_task *task, void *data) | |||
429 | static void filelayout_write_release(void *data) | 438 | static void filelayout_write_release(void *data) |
430 | { | 439 | { |
431 | struct nfs_write_data *wdata = data; | 440 | struct nfs_write_data *wdata = data; |
441 | struct pnfs_layout_hdr *lo = wdata->header->lseg->pls_layout; | ||
432 | 442 | ||
443 | filelayout_fenceme(lo->plh_inode, lo); | ||
433 | nfs_put_client(wdata->ds_clp); | 444 | nfs_put_client(wdata->ds_clp); |
434 | wdata->header->mds_ops->rpc_release(data); | 445 | wdata->header->mds_ops->rpc_release(data); |
435 | } | 446 | } |
@@ -739,7 +750,7 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo, | |||
739 | goto out_err; | 750 | goto out_err; |
740 | 751 | ||
741 | if (fl->num_fh > 0) { | 752 | if (fl->num_fh > 0) { |
742 | fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *), | 753 | fl->fh_array = kcalloc(fl->num_fh, sizeof(fl->fh_array[0]), |
743 | gfp_flags); | 754 | gfp_flags); |
744 | if (!fl->fh_array) | 755 | if (!fl->fh_array) |
745 | goto out_err; | 756 | goto out_err; |
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h index dca47d786710..8c07241fe52b 100644 --- a/fs/nfs/nfs4filelayout.h +++ b/fs/nfs/nfs4filelayout.h | |||
@@ -149,6 +149,5 @@ extern void nfs4_fl_put_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); | |||
149 | extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); | 149 | extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); |
150 | struct nfs4_file_layout_dsaddr * | 150 | struct nfs4_file_layout_dsaddr * |
151 | filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags); | 151 | filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags); |
152 | void nfs4_ds_disconnect(struct nfs_client *clp); | ||
153 | 152 | ||
154 | #endif /* FS_NFS_NFS4FILELAYOUT_H */ | 153 | #endif /* FS_NFS_NFS4FILELAYOUT_H */ |
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index 3336d5eaf879..a8eaa9b7bb0f 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -149,28 +149,6 @@ _data_server_lookup_locked(const struct list_head *dsaddrs) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * Lookup DS by nfs_client pointer. Zero data server client pointer | ||
153 | */ | ||
154 | void nfs4_ds_disconnect(struct nfs_client *clp) | ||
155 | { | ||
156 | struct nfs4_pnfs_ds *ds; | ||
157 | struct nfs_client *found = NULL; | ||
158 | |||
159 | dprintk("%s clp %p\n", __func__, clp); | ||
160 | spin_lock(&nfs4_ds_cache_lock); | ||
161 | list_for_each_entry(ds, &nfs4_data_server_cache, ds_node) | ||
162 | if (ds->ds_clp && ds->ds_clp == clp) { | ||
163 | found = ds->ds_clp; | ||
164 | ds->ds_clp = NULL; | ||
165 | } | ||
166 | spin_unlock(&nfs4_ds_cache_lock); | ||
167 | if (found) { | ||
168 | set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); | ||
169 | nfs_put_client(clp); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | * Create an rpc connection to the nfs4_pnfs_ds data server | 152 | * Create an rpc connection to the nfs4_pnfs_ds data server |
175 | * Currently only supports IPv4 and IPv6 addresses | 153 | * Currently only supports IPv4 and IPv6 addresses |
176 | */ | 154 | */ |
diff --git a/fs/nfs/nfs4getroot.c b/fs/nfs/nfs4getroot.c index 6a83780e0ce6..549462e5b9b0 100644 --- a/fs/nfs/nfs4getroot.c +++ b/fs/nfs/nfs4getroot.c | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | #include <linux/nfs_fs.h> | 6 | #include <linux/nfs_fs.h> |
7 | #include "nfs4_fs.h" | 7 | #include "nfs4_fs.h" |
8 | #include "internal.h" | ||
8 | 9 | ||
9 | #define NFSDBG_FACILITY NFSDBG_CLIENT | 10 | #define NFSDBG_FACILITY NFSDBG_CLIENT |
10 | 11 | ||
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index be731e6b7b9c..c6f990656f89 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c | |||
@@ -369,7 +369,7 @@ void objio_free_result(struct objlayout_io_res *oir) | |||
369 | kfree(objios); | 369 | kfree(objios); |
370 | } | 370 | } |
371 | 371 | ||
372 | enum pnfs_osd_errno osd_pri_2_pnfs_err(enum osd_err_priority oep) | 372 | static enum pnfs_osd_errno osd_pri_2_pnfs_err(enum osd_err_priority oep) |
373 | { | 373 | { |
374 | switch (oep) { | 374 | switch (oep) { |
375 | case OSD_ERR_PRI_NO_ERROR: | 375 | case OSD_ERR_PRI_NO_ERROR: |
@@ -574,7 +574,7 @@ static bool objio_pg_test(struct nfs_pageio_descriptor *pgio, | |||
574 | (unsigned long)pgio->pg_layout_private; | 574 | (unsigned long)pgio->pg_layout_private; |
575 | } | 575 | } |
576 | 576 | ||
577 | void objio_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) | 577 | static void objio_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) |
578 | { | 578 | { |
579 | pnfs_generic_pg_init_read(pgio, req); | 579 | pnfs_generic_pg_init_read(pgio, req); |
580 | if (unlikely(pgio->pg_lseg == NULL)) | 580 | if (unlikely(pgio->pg_lseg == NULL)) |
@@ -604,7 +604,7 @@ static bool aligned_on_raid_stripe(u64 offset, struct ore_layout *layout, | |||
604 | return false; | 604 | return false; |
605 | } | 605 | } |
606 | 606 | ||
607 | void objio_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) | 607 | static void objio_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) |
608 | { | 608 | { |
609 | unsigned long stripe_end = 0; | 609 | unsigned long stripe_end = 0; |
610 | u64 wb_size; | 610 | u64 wb_size; |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 2d722dba1111..dbf7bba52da0 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -62,6 +62,7 @@ enum { | |||
62 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ | 62 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ |
63 | NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ | 63 | NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ |
64 | NFS_LAYOUT_ROC, /* some lseg had roc bit set */ | 64 | NFS_LAYOUT_ROC, /* some lseg had roc bit set */ |
65 | NFS_LAYOUT_RETURN, /* Return this layout ASAP */ | ||
65 | }; | 66 | }; |
66 | 67 | ||
67 | enum layoutdriver_policy_flags { | 68 | enum layoutdriver_policy_flags { |