Skip to contentSkip to conversation

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

PATCH In review Thomas Haynes 2 participants 2 messages Oct 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

From: Tom Haynes <[email protected]>

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.

---
 fs/nfs/pnfs.c | 3 +++
 1 file changed, 3 insertions(+)
fs/nfs/pnfs.c +3 -0
index 76de7f5..08b1060 100644
@@ -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);
 }
Signature · 1 line
1.9.3
#1 lore raw
Quoted 5 lines · Thomas Haynes

From: Tom Haynes <[email protected]>

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.