Skip to contentSkip to conversation

NFSD: Only reinitilize the recall_lru list under the recall lock

PATCH In review [email protected] 3 participants 7 messages Dec 13, 2011 – Dec 14, 2011

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

PATCH 1/1 NFSD: Only reinitilize the recall_lru list under the recall lock

From: Bryan Schumaker <[email protected]>

unhash_delegation() will grab the recall lock before calling list_del_init() in each of these places. This patch removes the redundant calls.

---
 fs/nfsd/nfs4state.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/nfsd/nfs4state.c +0 -3
index 6ab6779..43d5c22 100644
@@ -1058,7 +1058,6 @@ expire_client(struct nfs4_client *clp)
 	spin_unlock(&recall_lock);
 	while (!list_empty(&reaplist)) {
 		dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 	while (!list_empty(&clp->cl_openowners)) {
@@ -3125,7 +3124,6 @@ nfs4_laundromat(void)
 	spin_unlock(&recall_lock);
 	list_for_each_safe(pos, next, &reaplist) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 	test_val = nfsd4_lease;
@@ -4667,7 +4665,6 @@ __nfs4_state_shutdown(void)
 	spin_unlock(&recall_lock);
 	list_for_each_safe(pos, next, &reaplist) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 
Signature · 1 line
1.7.8
#1 lore raw
Quoted 5 lines · On Tue, Dec 13, 2011 at 04:35:58PM -0500, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

unhash_delegation() will grab the recall lock before calling list_del_init() in each of these places. This patch removes the redundant calls.

Looks right, thanks. (How did you happen across this?)

--b.

Quoted 37 lines
---
 fs/nfsd/nfs4state.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/nfsd/nfs4state.c +0 -3
index 6ab6779..43d5c22 100644
@@ -1058,7 +1058,6 @@ expire_client(struct nfs4_client *clp)
 	spin_unlock(&recall_lock);
 	while (!list_empty(&reaplist)) {
 		dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 	while (!list_empty(&clp->cl_openowners)) {
@@ -3125,7 +3124,6 @@ nfs4_laundromat(void)
 	spin_unlock(&recall_lock);
 	list_for_each_safe(pos, next, &reaplist) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 	test_val = nfsd4_lease;
@@ -4667,7 +4665,6 @@ __nfs4_state_shutdown(void)
 	spin_unlock(&recall_lock);
 	list_for_each_safe(pos, next, &reaplist) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 
Signature · 1 line
1.7.8
#2 lore raw
Quoted 8 lines · J. Bruce Fields
Quoted 5 lines · On Tue, Dec 13, 2011 at 04:35:58PM -0500, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

unhash_delegation() will grab the recall lock before calling list_del_init() in each of these places. This patch removes the redundant calls.

Looks right, thanks. (How did you happen across this?)

I was looking over the fault injection stuff to see if I can figure out where an occasional oops was coming from. It seems to happen when I forget delegations, so I was looking at how other functions release delegations to see if there was something I missed. The oops doesn't happen often enough for me to know if this patch fixes it yet, though.

- Bryan

Quoted 44 lines

--b.

Quoted 37 lines
---
 fs/nfsd/nfs4state.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/nfsd/nfs4state.c +0 -3
index 6ab6779..43d5c22 100644
@@ -1058,7 +1058,6 @@ expire_client(struct nfs4_client *clp)
 	spin_unlock(&recall_lock);
 	while (!list_empty(&reaplist)) {
 		dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 	while (!list_empty(&clp->cl_openowners)) {
@@ -3125,7 +3124,6 @@ nfs4_laundromat(void)
 	spin_unlock(&recall_lock);
 	list_for_each_safe(pos, next, &reaplist) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 	test_val = nfsd4_lease;
@@ -4667,7 +4665,6 @@ __nfs4_state_shutdown(void)
 	spin_unlock(&recall_lock);
 	list_for_each_safe(pos, next, &reaplist) {
 		dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
-		list_del_init(&dp->dl_recall_lru);
 		unhash_delegation(dp);
 	}
 
Signature · 1 line
1.7.8

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 8 lines · Bryan Schumaker
Quoted 7 lines · J. Bruce Fields
Quoted 5 lines · On Tue, Dec 13, 2011 at 04:35:58PM -0500, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

unhash_delegation() will grab the recall lock before calling list_del_init() in each of these places. This patch removes the redundant calls.

Quoted 7 lines
Quoted 1 line

Looks right, thanks. (How did you happen across this?)

I was looking over the fault injection stuff to see if I can figure out where an occasional oops was coming from. It seems to happen when I forget delegations, so I was looking at how other functions release delegations to see if there was something I missed. The oops doesn't happen often enough for me to know if this patch fixes it yet, though.

Hm, OK. Could you post the oops?

--b.

#4 lore raw
Quoted 11 lines · J. Bruce Fields
Quoted 10 lines · Bryan Schumaker
Quoted 8 lines · J. Bruce Fields
Quoted 5 lines · On Tue, Dec 13, 2011 at 04:35:58PM -0500, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

unhash_delegation() will grab the recall lock before calling list_del_init() in each of these places. This patch removes the redundant calls.

Looks right, thanks. (How did you happen across this?)

Quoted 7 lines
Quoted 5 lines

I was looking over the fault injection stuff to see if I can figure out where an occasional oops was coming from. It seems to happen when I forget delegations, so I was looking at how other functions release delegations to see if there was something I missed. The oops doesn't happen often enough for me to know if this patch fixes it yet, though.

Hm, OK. Could you post the oops?

I don't see it in the logs on the server, but I'll keep looking. I'll post it the next time I come across it.

- Bryan

Quoted 2 lines

--b.

#5 lore raw
Quoted 18 lines · Bryan Schumaker
Quoted 17 lines · J. Bruce Fields
Quoted 15 lines · Bryan Schumaker
Quoted 8 lines · J. Bruce Fields
Quoted 5 lines · On Tue, Dec 13, 2011 at 04:35:58PM -0500, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

unhash_delegation() will grab the recall lock before calling list_del_init() in each of these places.  This patch removes the redundant calls.

Looks right, thanks.  (How did you happen across this?)

I was looking over the fault injection stuff to see if I can figure out where an occasional oops was coming from.  It seems to happen when I forget delegations, so I was looking at how other functions release delegations to see if there was something I missed.  The oops doesn't happen often enough for me to know if this patch fixes it yet, though.

Quoted 4 lines
Quoted 1 line

Hm, OK.  Could you post the oops?

I don't see it in the logs on the server, but I'll keep looking.  I'll post it the next time I come across it.

I'm not sure if this is the same oops, but I'm able to reproduce it consistently against Bruce's 3.2.0-rc1 tree with fault injection enabled. I use the windows client to read a file, then 'echo 0 > /sys/kernel/debug/nfsd/forget_delegations'. I just tested with the patch above, and was able to reproduce the same oops:

[ 1200.251735] NFSD Fault Injection: forget_delegations (all)
[ 1200.251830] general protection fault: 0000 [#1] SMP
[ 1200.252450] CPU 1
[ 1200.252597] Modules linked in:
[ 1200.253062]
[ 1200.253256] Pid: 2004, comm: bash Not tainted 3.2.0-rc1+ #9 VMware,
Inc. VMware Virtual Platform/440BX Desktop Reference Platform
[ 1200.254102] RIP: 0010:[<ffffffff811ae7f5>]  [<ffffffff811ae7f5>]
nfsd_process_n_delegations+0x3e/0xbe
[ 1200.254746] RSP: 0018:ffff88003b579e08  EFLAGS: 00010287
[ 1200.255067] RAX: dead000000100100 RBX: 0000000000000000 RCX: 00000001802c002b
[ 1200.255458] RDX: ffff88003d2d3328 RSI: ffffffff811aa49e RDI: ffff88003d2d3308
[ 1200.255842] RBP: ffff88003b579e58 R08: ffff88003b558000 R09: ffff88003d2d3480
[ 1200.256226] R10: ffff88003b68b750 R11: 0000000000000040 R12: dead0000001000f8
[ 1200.256610] R13: 0000000000000001 R14: 000000000000002b R15: 00000000000000d5
[ 1200.257029] FS:  00007fbad1d44700(0000) GS:ffff88003fa20000(0000)
knlGS:0000000000000000
[ 1200.257512] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1200.257850] CR2: 00007fbad1d49000 CR3: 000000003b593000 CR4: 00000000000006e0
[ 1200.258272] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1200.258693] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 1200.259083] Process bash (pid: 2004, threadinfo ffff88003b578000,
task ffff88003cc3dfe0)
[ 1200.259561] Stack:
[ 1200.259768]  ffffffff811aa49e ffff88003d2d3308 ffffffff81be1560
ffff88003d2d3328
[ 1200.260553]  ffff88003b579e88 ffffffff81a2b6a0 0000000000000000
0000000000000002
[ 1200.261337]  ffff88003d8c1550 ffff88003d8c1528 ffff88003b579e88
ffffffff811ae897
[ 1200.262121] Call Trace:
[ 1200.262346]  [<ffffffff811aa49e>] ? nfs4_put_delegation+0x55/0x55
[ 1200.262701]  [<ffffffff811ae897>] nfsd_forget_delegations+0x22/0x40
[ 1200.263119]  [<ffffffff8119d3e7>] nfsd_inject_set+0x3f/0x46
[ 1200.263470]  [<ffffffff810fb878>] simple_attr_write+0x8a/0xb2
[ 1200.263818]  [<ffffffff810e0949>] vfs_write+0xa7/0xfa
[ 1200.264136]  [<ffffffff810e0b41>] sys_write+0x45/0x69
[ 1200.264483]  [<ffffffff81450f3b>] system_call_fastpath+0x16/0x1b
[ 1200.264832] Code: 45 31 ed 41 54 53 48 89 fb 48 83 ec 28 49 63 c6
48 c1 e0 04 4c 8b a0 b0 12 be 81 48 05 b0 12 be 81 48 89 45 c0 49 83
ec 08 eb 57
[ 1200.270209]  8b 7c 24 28 49 8d 54 24 28 48 89 55 c8 48 83 ef 20 48 8b 47
[ 1200.272534] RIP  [<ffffffff811ae7f5>] nfsd_process_n_delegations+0x3e/0xbe
[ 1200.273007]  RSP <ffff88003b579e08>
[ 1200.273331] ---[ end trace 0071bb3837d120e2 ]---
Quoted 10 lines

- Bryan

Quoted 2 lines

--b.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 67 lines · Casey Bodley
Quoted 18 lines · Bryan Schumaker
Quoted 17 lines · J. Bruce Fields
Quoted 15 lines · Bryan Schumaker
Quoted 8 lines · J. Bruce Fields
Quoted 5 lines · On Tue, Dec 13, 2011 at 04:35:58PM -0500, [email protected] wrote:

From: Bryan Schumaker <[email protected]>

unhash_delegation() will grab the recall lock before calling list_del_init() in each of these places. This patch removes the redundant calls.

Looks right, thanks. (How did you happen across this?)

I was looking over the fault injection stuff to see if I can figure out where an occasional oops was coming from. It seems to happen when I forget delegations, so I was looking at how other functions release delegations to see if there was something I missed. The oops doesn't happen often enough for me to know if this patch fixes it yet, though.

Quoted 4 lines
Quoted 1 line

Hm, OK. Could you post the oops?

I don't see it in the logs on the server, but I'll keep looking. I'll post it the next time I come across it.

I'm not sure if this is the same oops, but I'm able to reproduce it consistently against Bruce's 3.2.0-rc1 tree with fault injection enabled. I use the windows client to read a file, then 'echo 0 > /sys/kernel/debug/nfsd/forget_delegations'. I just tested with the patch above, and was able to reproduce the same oops:

[ 1200.251735] NFSD Fault Injection: forget_delegations (all)
[ 1200.251830] general protection fault: 0000 [#1] SMP
[ 1200.252450] CPU 1
[ 1200.252597] Modules linked in:
[ 1200.253062]
[ 1200.253256] Pid: 2004, comm: bash Not tainted 3.2.0-rc1+ #9 VMware,
Inc. VMware Virtual Platform/440BX Desktop Reference Platform
[ 1200.254102] RIP: 0010:[<ffffffff811ae7f5>]  [<ffffffff811ae7f5>]
nfsd_process_n_delegations+0x3e/0xbe
[ 1200.254746] RSP: 0018:ffff88003b579e08  EFLAGS: 00010287
[ 1200.255067] RAX: dead000000100100 RBX: 0000000000000000 RCX: 00000001802c002b
[ 1200.255458] RDX: ffff88003d2d3328 RSI: ffffffff811aa49e RDI: ffff88003d2d3308
[ 1200.255842] RBP: ffff88003b579e58 R08: ffff88003b558000 R09: ffff88003d2d3480
[ 1200.256226] R10: ffff88003b68b750 R11: 0000000000000040 R12: dead0000001000f8
[ 1200.256610] R13: 0000000000000001 R14: 000000000000002b R15: 00000000000000d5
[ 1200.257029] FS:  00007fbad1d44700(0000) GS:ffff88003fa20000(0000)
knlGS:0000000000000000
[ 1200.257512] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1200.257850] CR2: 00007fbad1d49000 CR3: 000000003b593000 CR4: 00000000000006e0
[ 1200.258272] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1200.258693] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 1200.259083] Process bash (pid: 2004, threadinfo ffff88003b578000,
task ffff88003cc3dfe0)
[ 1200.259561] Stack:
[ 1200.259768]  ffffffff811aa49e ffff88003d2d3308 ffffffff81be1560
ffff88003d2d3328
[ 1200.260553]  ffff88003b579e88 ffffffff81a2b6a0 0000000000000000
0000000000000002
[ 1200.261337]  ffff88003d8c1550 ffff88003d8c1528 ffff88003b579e88
ffffffff811ae897
[ 1200.262121] Call Trace:
[ 1200.262346]  [<ffffffff811aa49e>] ? nfs4_put_delegation+0x55/0x55
[ 1200.262701]  [<ffffffff811ae897>] nfsd_forget_delegations+0x22/0x40
[ 1200.263119]  [<ffffffff8119d3e7>] nfsd_inject_set+0x3f/0x46
[ 1200.263470]  [<ffffffff810fb878>] simple_attr_write+0x8a/0xb2
[ 1200.263818]  [<ffffffff810e0949>] vfs_write+0xa7/0xfa
[ 1200.264136]  [<ffffffff810e0b41>] sys_write+0x45/0x69
Quoted 8 lines
[ 1200.264483]  [<ffffffff81450f3b>] system_call_fastpath+0x16/0x1b
[ 1200.264832] Code: 45 31 ed 41 54 53 48 89 fb 48 83 ec 28 49 63 c6
48 c1 e0 04 4c 8b a0 b0 12 be 81 48 05 b0 12 be 81 48 89 45 c0 49 83
ec 08 eb 57
[ 1200.270209]  8b 7c 24 28 49 8d 54 24 28 48 89 55 c8 48 83 ef 20 48 8b 47
[ 1200.272534] RIP  [<ffffffff811ae7f5>] nfsd_process_n_delegations+0x3e/0xbe
[ 1200.273007]  RSP <ffff88003b579e08>
[ 1200.273331] ---[ end trace 0071bb3837d120e2 ]---

That's similar to the one I just got. Thanks for the test case! I had been opening two files in order to get a read delegation, I didn't think of trying with just one. Here is what I got:

Dec 14 11:21:01 localhost -- MARK --
Dec 14 11:45:00 localhost kernel: [ 7716.735003] NFSD Fault Injection: 
forget_delegations (all)
Dec 14 11:45:00 localhost kernel: [ 7716.735814] CPU 0 
Dec 14 11:45:00 localhost kernel: [ 7716.735902] Modules linked in: 

dm_mod md5 nfsd exportfs nfs lockd fscache auth_rpcgss nfs_acl sunrpc ipv6 ext2 mbcache loop snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_timer psmouse snd serio_raw soundcore pcspkr snd_page_alloc virtio_balloon i2c_piix4 evdev i2c_core floppy processor button btrfs zlib_deflate crc32c libcrc32c sr_mod cdrom pata_acpi uhci_hcd ata_piix usbcore usb_common libata scsi_mod virtio_net virtio_pci virtio_blk virtio_ring virtio

Dec 14 11:45:00 localhost kernel: [ 7716.737782] 
Dec 14 11:45:00 localhost kernel: [ 7716.737782] Pid: 17423, comm: bash 
Not tainted 3.2.0-rc1-BRYAN+ #1 Bochs Bochs
Dec 14 11:45:00 localhost kernel: [ 7716.737782] RIP: 
0010:[<ffffffffa0415533>]  [<ffffffffa0415533>] 
nfsd_process_n_delegations+0x53/0xe0 [nfsd]
Dec 14 11:45:00 localhost kernel: [ 7716.737782] RSP: 
0018:ffff880034121e18  EFLAGS: 00010202
Dec 14 11:45:00 localhost kernel: [ 7716.737782] RAX: dead000000100100 
RBX: 0000000000000000 RCX: 0000000000000200
Dec 14 11:45:00 localhost kernel: [ 7716.737782] RDX: dead0000001000f8 
RSI: 000060ffc0001270 RDI: ffffea0000d93400
Dec 14 11:45:00 localhost kernel: [ 7716.737782] RBP: ffff880034121e68 
R08: ffffffffa040fc26 R09: 0000000000000000
Dec 14 11:45:00 localhost kernel: [ 7716.737782] R10: ffff88002b206a90 
R11: 0000000000000000 R12: ffff88002eed4188
Dec 14 11:45:00 localhost kernel: [ 7716.737782] R13: 0000000000000001 
R14: ffff88002eed41a8 R15: ffffffffa040fcb0
Dec 14 11:45:00 localhost kernel: [ 7716.737782] FS:  
00007f09bfb8c700(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
Dec 14 11:45:00 localhost kernel: [ 7716.737782] CS:  0010 DS: 0000 ES: 
0000 CR0: 0000000080050033
Dec 14 11:45:00 localhost kernel: [ 7716.737782] CR2: 00007f09bfb92000 
CR3: 000000003a90f000 CR4: 00000000000006f0
Dec 14 11:45:00 localhost kernel: [ 7716.737782] DR0: 0000000000000000 
DR1: 0000000000000000 DR2: 0000000000000000
Dec 14 11:45:00 localhost kernel: [ 7716.737782] DR3: 0000000000000000 
DR6: 00000000ffff0ff0 DR7: 0000000000000400
Dec 14 11:45:00 localhost kernel: [ 7716.737782] Process bash (pid: 
17423, threadinfo ffff880034120000, task ffff88003c0064a0)
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  ffffffffa041ffb0 
00000000000000f7 ffffffffa04283b0 dead0000001000f8
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  ffff880034121e58 
0000000000000000 ffffffffa041ffb0 ffff88002eed48d0
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  0000000000000002 
ffff88002eed48a8 ffff880034121e88 ffffffffa04155e5
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  [<ffffffffa04155e5>] 
nfsd_forget_delegations+0x25/0x50 [nfsd]
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  [<ffffffffa03fd75c>] 
nfsd_inject_set+0x3c/0x70 [nfsd]
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  [<ffffffff81186f22>] 
simple_attr_write+0xc2/0xe0
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  [<ffffffff811630ef>] 
vfs_write+0xaf/0x180
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  [<ffffffff8116341a>] 
sys_write+0x4a/0x90
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  [<ffffffff81417e42>] 
system_call_fastpath+0x16/0x1b
Dec 14 11:45:00 localhost kernel: [ 7716.737782]  RSP <ffff880034121e18>
Dec 14 11:45:00 localhost kernel: [ 7716.754976] ---[ end trace 

f7471c4cb1a3a2f4 ]---

- Bryan

Quoted 11 lines
Quoted 11 lines

- Bryan

Quoted 2 lines

--b.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html