diff mbox

pnfs: Do not schedule layout segment work if there is no work to be done.

Message ID 1412704787-46388-1-git-send-email-Thomas.Haynes@primarydata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Haynes Oct. 7, 2014, 5:59 p.m. UTC
From: Tom Haynes <loghyr@primarydata.com>

Callers of pnfs_put_lseg_async() might encounter no writes to
be committed, etc. As such, do not attempt to add work if none
is needed. Also, don't oops if that is the case.

Signed-off-by: Tom Haynes <loghyr@primarydata.com>
---
 fs/nfs/pnfs.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christoph Hellwig Oct. 7, 2014, 6:02 p.m. UTC | #1
On Tue, Oct 07, 2014 at 10:59:47AM -0700, Thomas Haynes wrote:
> From: Tom Haynes <loghyr@primarydata.com>
> 
> Callers of pnfs_put_lseg_async() might encounter no writes to
> be committed, etc. As such, do not attempt to add work if none
> is needed. Also, don't oops if that is the case.

I think that last issue is the main culprit, isn't it? :)

I still think adding the NULL check to filelayout_clear_request_commit
would be more reasonable, as it's clear that freeme can be NULL there,
but as pnfs_put_lseg accepts a NULL lseg it's probably wise to keep
the two in sync.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 76de7f5..08b1060 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -373,6 +373,9 @@  static void pnfs_put_lseg_async_work(struct work_struct *work)
 void
 pnfs_put_lseg_async(struct pnfs_layout_segment *lseg)
 {
+	if (!lseg)
+		return;
+
 	INIT_WORK(&lseg->pls_work, pnfs_put_lseg_async_work);
 	schedule_work(&lseg->pls_work);
 }