Skip to content

Commit e18c18e

Browse files
author
Trond Myklebust
committed
NFS/pNFS: Fix pnfs_layout_mark_request_commit() invalid layout segment handling
Fix up pnfs_layout_mark_request_commit() to alway reschedule the write if the layout segment is invalid. Also minor cleanup. Signed-off-by: Trond Myklebust <[email protected]>
1 parent c84bea5 commit e18c18e

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

fs/nfs/pnfs_nfs.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,26 +1166,22 @@ pnfs_layout_mark_request_commit(struct nfs_page *req,
11661166
{
11671167
struct list_head *list;
11681168
struct pnfs_commit_array *array;
1169-
struct pnfs_commit_bucket *buckets;
1169+
struct pnfs_commit_bucket *bucket;
11701170

11711171
mutex_lock(&NFS_I(cinfo->inode)->commit_mutex);
11721172
array = pnfs_lookup_commit_array(cinfo->ds, lseg);
1173-
if (!array)
1173+
if (!array || !pnfs_is_valid_lseg(lseg))
11741174
goto out_resched;
1175-
buckets = array->buckets;
1176-
list = &buckets[ds_commit_idx].written;
1177-
if (list_empty(list)) {
1178-
if (!pnfs_is_valid_lseg(lseg))
1179-
goto out_resched;
1180-
/* Non-empty buckets hold a reference on the lseg. That ref
1181-
* is normally transferred to the COMMIT call and released
1182-
* there. It could also be released if the last req is pulled
1183-
* off due to a rewrite, in which case it will be done in
1184-
* pnfs_common_clear_request_commit
1185-
*/
1186-
if (!buckets[ds_commit_idx].lseg)
1187-
buckets[ds_commit_idx].lseg = pnfs_get_lseg(lseg);
1188-
}
1175+
bucket = &array->buckets[ds_commit_idx];
1176+
list = &bucket->written;
1177+
/* Non-empty buckets hold a reference on the lseg. That ref
1178+
* is normally transferred to the COMMIT call and released
1179+
* there. It could also be released if the last req is pulled
1180+
* off due to a rewrite, in which case it will be done in
1181+
* pnfs_common_clear_request_commit
1182+
*/
1183+
if (!bucket->lseg)
1184+
bucket->lseg = pnfs_get_lseg(lseg);
11891185
set_bit(PG_COMMIT_TO_DS, &req->wb_flags);
11901186
cinfo->ds->nwritten++;
11911187

0 commit comments

Comments
 (0)