Commit e18c18eb authored by Trond Myklebust's avatar Trond Myklebust

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: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent c84bea59
...@@ -1166,26 +1166,22 @@ pnfs_layout_mark_request_commit(struct nfs_page *req, ...@@ -1166,26 +1166,22 @@ pnfs_layout_mark_request_commit(struct nfs_page *req,
{ {
struct list_head *list; struct list_head *list;
struct pnfs_commit_array *array; struct pnfs_commit_array *array;
struct pnfs_commit_bucket *buckets; struct pnfs_commit_bucket *bucket;
mutex_lock(&NFS_I(cinfo->inode)->commit_mutex); mutex_lock(&NFS_I(cinfo->inode)->commit_mutex);
array = pnfs_lookup_commit_array(cinfo->ds, lseg); array = pnfs_lookup_commit_array(cinfo->ds, lseg);
if (!array) if (!array || !pnfs_is_valid_lseg(lseg))
goto out_resched; goto out_resched;
buckets = array->buckets; bucket = &array->buckets[ds_commit_idx];
list = &buckets[ds_commit_idx].written; list = &bucket->written;
if (list_empty(list)) { /* Non-empty buckets hold a reference on the lseg. That ref
if (!pnfs_is_valid_lseg(lseg)) * is normally transferred to the COMMIT call and released
goto out_resched; * there. It could also be released if the last req is pulled
/* Non-empty buckets hold a reference on the lseg. That ref * off due to a rewrite, in which case it will be done in
* is normally transferred to the COMMIT call and released * pnfs_common_clear_request_commit
* there. It could also be released if the last req is pulled */
* off due to a rewrite, in which case it will be done in if (!bucket->lseg)
* pnfs_common_clear_request_commit bucket->lseg = pnfs_get_lseg(lseg);
*/
if (!buckets[ds_commit_idx].lseg)
buckets[ds_commit_idx].lseg = pnfs_get_lseg(lseg);
}
set_bit(PG_COMMIT_TO_DS, &req->wb_flags); set_bit(PG_COMMIT_TO_DS, &req->wb_flags);
cinfo->ds->nwritten++; cinfo->ds->nwritten++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment