From: Trond Myklebust <trond.myklebust@primarydata.com>
To: stable@vger.kernel.org
Cc: Weston Andros Adamson <dros@primarydata.com>, linux-nfs@vger.kernel.org
Subject: [PATCH 07/14] nfs: clear_request_commit while holding i_lock
Date: Mon, 15 Sep 2014 14:14:38 -0400 [thread overview]
Message-ID: <1410804885-17228-8-git-send-email-trond.myklebust@primarydata.com> (raw)
In-Reply-To: <1410804885-17228-7-git-send-email-trond.myklebust@primarydata.com>
From: Weston Andros Adamson <dros@primarydata.com>
commit 411a99adffb4f993eee29759f744de01487044ac upstream.
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
fs/nfs/filelayout/filelayout.c | 5 ++---
fs/nfs/write.c | 15 ++++-----------
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 537e7f7a0b48..a596a1938b52 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -1015,6 +1015,7 @@ static u32 select_bucket_index(struct nfs4_filelayout_segment *fl, u32 j)
/* The generic layer is about to remove the req from the commit list.
* If this will make the bucket empty, it will need to put the lseg reference.
+ * Note this is must be called holding the inode (/cinfo) lock
*/
static void
filelayout_clear_request_commit(struct nfs_page *req,
@@ -1022,7 +1023,6 @@ filelayout_clear_request_commit(struct nfs_page *req,
{
struct pnfs_layout_segment *freeme = NULL;
- spin_lock(cinfo->lock);
if (!test_and_clear_bit(PG_COMMIT_TO_DS, &req->wb_flags))
goto out;
cinfo->ds->nwritten--;
@@ -1037,8 +1037,7 @@ filelayout_clear_request_commit(struct nfs_page *req,
}
out:
nfs_request_remove_commit_list(req, cinfo);
- spin_unlock(cinfo->lock);
- pnfs_put_lseg(freeme);
+ pnfs_put_lseg_async(freeme);
}
static struct list_head *
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2ed54b224bf2..e3054af396e9 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -379,8 +379,6 @@ nfs_destroy_unlinked_subrequests(struct nfs_page *destroy_list,
subreq->wb_head = subreq;
subreq->wb_this_page = subreq;
- nfs_clear_request_commit(subreq);
-
/* subreq is now totally disconnected from page group or any
* write / commit lists. last chance to wake any waiters */
nfs_unlock_request(subreq);
@@ -490,7 +488,7 @@ try_again:
* Commit list removal accounting is done after locks are dropped */
subreq = head;
do {
- nfs_list_remove_request(subreq);
+ nfs_clear_request_commit(subreq);
subreq = subreq->wb_this_page;
} while (subreq != head);
@@ -520,15 +518,11 @@ try_again:
nfs_page_group_unlock(head);
- /* drop lock to clear_request_commit the head req and clean up
- * requests on destroy list */
+ /* drop lock to clean uprequests on destroy list */
spin_unlock(&inode->i_lock);
nfs_destroy_unlinked_subrequests(destroy_list, head);
- /* clean up commit list state */
- nfs_clear_request_commit(head);
-
/* still holds ref on head from nfs_page_find_head_request_locked
* and still has lock on head from lock loop */
return head;
@@ -810,6 +804,7 @@ nfs_clear_page_commit(struct page *page)
dec_bdi_stat(page_file_mapping(page)->backing_dev_info, BDI_RECLAIMABLE);
}
+/* Called holding inode (/cinfo) lock */
static void
nfs_clear_request_commit(struct nfs_page *req)
{
@@ -819,9 +814,7 @@ nfs_clear_request_commit(struct nfs_page *req)
nfs_init_cinfo_from_inode(&cinfo, inode);
if (!pnfs_clear_request_commit(req, &cinfo)) {
- spin_lock(cinfo.lock);
nfs_request_remove_commit_list(req, &cinfo);
- spin_unlock(cinfo.lock);
}
nfs_clear_page_commit(req->wb_page);
}
@@ -1040,9 +1033,9 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,
else
req->wb_bytes = rqend - req->wb_offset;
out_unlock:
- spin_unlock(&inode->i_lock);
if (req)
nfs_clear_request_commit(req);
+ spin_unlock(&inode->i_lock);
return req;
out_flushme:
spin_unlock(&inode->i_lock);
--
1.9.3
next prev parent reply other threads:[~2014-09-15 18:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-15 18:14 [PATCH 00/14] Stable fixes for NFS client read/write code in 3.16.x Trond Myklebust
2014-09-15 18:14 ` [PATCH 01/14] nfs: move nfs_pgio_data and remove nfs_rw_header Trond Myklebust
2014-09-15 18:14 ` [PATCH 02/14] nfs: rename members of nfs_pgio_data Trond Myklebust
2014-09-15 18:14 ` [PATCH 03/14] nfs: merge nfs_pgio_data into _header Trond Myklebust
2014-09-15 18:14 ` [PATCH 04/14] nfs: remove pgio_header refcount, related cleanup Trond Myklebust
2014-09-15 18:14 ` [PATCH 05/14] nfs: check wait_on_bit_lock err in page_group_lock Trond Myklebust
2014-09-15 18:14 ` [PATCH 06/14] pnfs: add pnfs_put_lseg_async Trond Myklebust
2014-09-15 18:14 ` Trond Myklebust [this message]
2014-09-15 18:14 ` [PATCH 08/14] nfs: change nfs_page_group_lock argument Trond Myklebust
2014-09-15 18:14 ` [PATCH 09/14] nfs: fix nonblocking calls to nfs_page_group_lock Trond Myklebust
2014-09-15 18:14 ` [PATCH 10/14] nfs: use blocking page_group_lock in add_request Trond Myklebust
2014-09-15 18:14 ` [PATCH 11/14] nfs: fix error handling in lock_and_join_requests Trond Myklebust
2014-09-15 18:14 ` [PATCH 12/14] nfs: don't sleep with inode lock " Trond Myklebust
2014-09-15 18:14 ` [PATCH 13/14] nfs: disallow duplicate pages in pgio page vectors Trond Myklebust
2014-09-15 18:14 ` [PATCH 14/14] nfs: can_coalesce_requests must enforce contiguity Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410804885-17228-8-git-send-email-trond.myklebust@primarydata.com \
--to=trond.myklebust@primarydata.com \
--cc=dros@primarydata.com \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).