Skip to contentSkip to conversation

regression from commit 24408f5282

PATCH New Olga Kornievskaia 3 participants 4 messages Jan 26, 2017

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

Hi Trond,

There is regression in the upstream code, it leaves dangling DS mounts. Problem didn't exist in 4.9 and appeared in 4.10.

Simple test is : mount, echo 1 > /mnt/foobar, unmount /mnt. Watch the DS mount keep going.

The last commit at which the code works is: fe1cf9469d7 "pNFS: Clear all layout segment state in pnfs_mark_layout_stateaid_invalid".

Applying commit 24408f5282 "pNFS: Fix bugs in _pnfs_return_layout" introduces the problem.

#1 lore raw

PATCH 1/1 pNFS: Fix a reference leak in _pnfs_return_layout

IF NFS_LAYOUT_RETURN_REQUESTED is not set, then we currently exit without freeing the list of invalidated layout segments, leading to a reference leak.

Fixes 24408f5282 ("pNFS: Fix bugs in _pnfs_return_layout")
---
 fs/nfs/pnfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/pnfs.c +1 -1
index 59554f3adf29..dd042498ce7c 100644
@@ -1200,10 +1200,10 @@ _pnfs_return_layout(struct inode *ino)
 
 	send = pnfs_prepare_layoutreturn(lo, &stateid, NULL);
 	spin_unlock(&ino->i_lock);
-	pnfs_free_lseg_list(&tmp_list);
 	if (send)
 		status = pnfs_send_layoutreturn(lo, &stateid, IOMODE_ANY, true);
 out_put_layout_hdr:
+	pnfs_free_lseg_list(&tmp_list);
 	pnfs_put_layout_hdr(lo);
 out:
 	dprintk("<-- %s status: %d\n", __func__, status);
Signature · 1 line
2.9.3
#2 lore raw
In reply to Olga Kornievskaia

T24gVGh1LCAyMDE3LTAxLTI2IGF0IDE1OjAxIC0wNTAwLCBPbGdhIEtvcm5pZXZza2FpYSB3cm90 ZToNCj4gSGkgVHJvbmQsDQo+IA0KPiBUaGVyZSBpcyByZWdyZXNzaW9uIGluIHRoZSB1cHN0cmVh bSBjb2RlLCBpdCBsZWF2ZXMgZGFuZ2xpbmcgRFMNCj4gbW91bnRzLiBQcm9ibGVtIGR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BwYXRjaCBJIGp1c3Qg c2VudCB5b3UgZml4IHRoZSByZWdyZXNzaW9uPw0KDQpDaGVlcnMsDQogIFRyb25kDQoNCi0tIA0K VHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXIsIFByaW1hcnlEYXRh DQp0cm9uZC5teWtsZWJ1c3RAcHJpbWFyeWRhdGEuY29tDQo=

#3 lore raw
Quoted 23 lines · Trond Myklebust
Quoted 22 lines · Olga Kornievskaia

Hi Trond,

There is regression in the upstream code, it leaves dangling DS mounts. Problem didn't exist in 4.9 and appeared in 4.10.

Simple test is : mount, echo 1 > /mnt/foobar, unmount /mnt. Watch the DS mount keep going.

The last commit at which the code works is: fe1cf9469d7 "pNFS: Clear all layout segment state in pnfs_mark_layout_stateaid_invalid".

Applying commit 24408f5282 "pNFS: Fix bugs in _pnfs_return_layout" introduces the problem.

From what I can tell the code is either missing setting NFS_LAYOUT_RETURN_REQUESTED somewhere but I'm not sure.

Or if the intent was to just never return the layout even on the unmount, then we need to drop the ref count on the layout here so that
unmount can proceed.

Quoted 6 lines
Quoted 4 lines

Can you clarify what should be happening here (or maybe something else
entirely)?

Does the patch I just sent you fix the regression?

Yes! that fixes the problem. Thank you.

Quoted 8 lines

Cheers,
Trond

--
Trond Myklebust
Linux NFS client maintainer, PrimaryData
[email protected]