Discussion:
[PATCH] pnfs: Do not schedule layout segment work if there is no work to be done.
Thomas Haynes
2014-10-07 17:59:47 UTC
Permalink
From: Tom Haynes <loghyr-7I+n7zu2hftEKMMhf/***@public.gmane.org>

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-7I+n7zu2hftEKMMhf/***@public.gmane.org>
---
fs/nfs/pnfs.c | 3 +++
1 file changed, 3 insertions(+)

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);
}
--
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Christoph Hellwig
2014-10-07 18:02:50 UTC
Permalink
Post by Thomas Haynes
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-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...