Re: [PATCH v2 03/12] NFS: Cache aggressively when file is open for writing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oleg,

Thanks for testing!

On Tue, 2016-06-21 at 18:25 -0400, Oleg Drokin wrote:
> This patch still crashes for me.
> 
> [  183.814855] BUG: unable to handle kernel paging request at
> ffff88001b18cfe8
> [  183.815403] IP: [<ffffffff81381b63>] nfs_update_inode+0x53/0xa30
> [  183.815868] PGD 3580067 PUD 3581067 PMD 77f69067 PTE
> 800000001b18c060
> [  183.816640] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
> [  183.817252] Modules linked in: loop rpcsec_gss_krb5 joydev
> acpi_cpufreq tpm_tis virtio_console tpm i2c_piix4 pcspkr nfsd ttm
> drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops
> virtio_blk serio_raw drm floppy
> [  183.820203] CPU: 6 PID: 40935 Comm: rm Not tainted 4.7.0-rc3-vm-
> nfst+ #6
> [  183.820818] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> [  183.821329] task: ffff88001b430c80 ti: ffff88001cf2c000 task.ti:
> ffff88001cf2c000
> [  183.822223] RIP: 0010:[<ffffffff81381b63>]  [<ffffffff81381b63>]
> nfs_update_inode+0x53/0xa30
> [  183.823007] RSP: 0018:ffff88001cf2fb08  EFLAGS: 00010283
> [  183.823417] RAX: ffff88001b18d000 RBX: ffff880021b582a8 RCX:
> 0000000000000000
> [  183.823845] RDX: ffff88001b18d000 RSI: ffff88001c3cdf00 RDI:
> ffff880021b582a8
> [  183.824276] RBP: ffff88001cf2fb58 R08: 0000000000000000 R09:
> 0000000000000001
> [  183.824701] R10: ffff88001b430c80 R11: 00000000fffe3818 R12:
> ffff88001c3cdf00
> [  183.825190] R13: ffff88001c3cdf00 R14: ffff88001c3cdf00 R15:
> 0000000000000001
> [  183.825651] FS:  00007fa0e9c5b700(0000) GS:ffff880075200000(0000)
> knlGS:0000000000000000
> [  183.826396] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [  183.826884] CR2: ffff88001b18cfe8 CR3: 000000001bc1f000 CR4:
> 00000000000006e0
> [  183.827460] Stack:
> [  183.827825]  ffff880000000000 ffff88001cf2fb58 0000000000000246
> ffffffff81382f33
> [  183.828734]  0000000000000246 ffff880021b582a8 ffff880021b582a8
> ffff88001c3cdf00
> [  183.829634]  ffff88001c3cdf00 0000000000000001 ffff88001cf2fb80
> ffffffff81382aa1
> [  183.830562] Call Trace:
> [  183.830938]  [<ffffffff81382f33>] ?
> nfs_refresh_inode.part.24+0x23/0x50
> [  183.831368]  [<ffffffff81382aa1>]
> nfs_refresh_inode_locked+0x71/0x4e0
> [  183.831785]  [<ffffffff81382f3e>]
> nfs_refresh_inode.part.24+0x2e/0x50
> [  183.832209]  [<ffffffff81384024>]
> __nfs_revalidate_inode+0x314/0x4b0
> [  183.832632]  [<ffffffff8137c6fe>] nfs_do_access+0x47e/0x620
> [  183.833036]  [<ffffffff8137c2d1>] ? nfs_do_access+0x51/0x620
> [  183.833456]  [<ffffffff818507ea>] ? generic_lookup_cred+0x1a/0x20
> [  183.833872]  [<ffffffff8184ef7e>] ? rpcauth_lookupcred+0x8e/0xd0
> [  183.834288]  [<ffffffff8137cb69>] nfs_permission+0x289/0x2e0
> [  183.834699]  [<ffffffff8137c943>] ? nfs_permission+0x63/0x2e0
> [  183.835108]  [<ffffffff812768da>] __inode_permission+0x6a/0xb0
> [  183.835521]  [<ffffffff81276934>] inode_permission+0x14/0x50
> [  183.835928]  [<ffffffff8127b2cf>] link_path_walk+0x2ef/0x6b0
> [  183.837327]  [<ffffffff8127b6a9>] ? path_parentat+0x19/0x80
> [  183.837988]  [<ffffffff8127b6be>] path_parentat+0x2e/0x80
> [  183.838653]  [<ffffffff8127cb13>] filename_parentat+0xb3/0x190
> [  183.839328]  [<ffffffff8123bc4c>] ?
> cache_alloc_debugcheck_after.isra.52+0x19c/0x1f0
> [  183.840533]  [<ffffffff8123e0a0>] ? kmem_cache_alloc+0x300/0x3d0
> [  183.841217]  [<ffffffff8127c89f>] ? getname_flags+0x4f/0x1f0
> [  183.841888]  [<ffffffff810e6d0d>] ? trace_hardirqs_on+0xd/0x10
> [  183.842570]  [<ffffffff8127d455>] do_unlinkat+0x65/0x2f0
> [  183.843243]  [<ffffffff8100201a>] ?
> trace_hardirqs_on_thunk+0x1a/0x1c
> [  183.843910]  [<ffffffff8127e17b>] SyS_unlinkat+0x1b/0x30
> [  183.844582]  [<ffffffff8188aebc>]
> entry_SYSCALL_64_fastpath+0x1f/0xbd
> 
> (gdb) l *(nfs_update_inode+0x53)
> 0xffffffff81381b63 is in nfs_update_inode (/home/green/bk/linux-
> test/fs/nfs/inode.c:1233).
> 1228		 *       being placed at the head of the list.
> 1229		 *       See nfs_inode_attach_open_context()
> 1230		 */
> 1231		return (list_first_entry(&nfsi->open_files,
> 1232				struct nfs_open_context,
> 1233				list)->mode & FMODE_WRITE) ==
> FMODE_WRITE;
> 1234	}
> 1235	
> 1236	static unsigned long nfs_wcc_update_inode(struct inode
> *inode, struct nfs_fattr *fattr)
> 1237	{
> 
> Reverting it makes the crash go away.
> 
> But there's also this other problem that I have not tracked to a
> particular patch yet:
> 
> [   25.830288] =============================================
> [   25.830468] [ INFO: possible recursive locking detected ]
> [   25.830658] 4.7.0-rc3-vm-nfst+ #8 Not tainted
> [   25.830822] ---------------------------------------------
> [   25.831009] cat/6588 is trying to acquire lock:
> [   25.831179]  (&sb->s_type->i_mutex_key#13){++++++}, at:
> [<ffffffff813841f4>] __nfs_revalidate_mapping+0x124/0x3e0
> [   25.832488] 
>                but task is already holding lock:
> [   25.833214]  (&sb->s_type->i_mutex_key#13){++++++}, at:
> [<ffffffff81388b7e>] nfs_start_io_read+0x1e/0x50
> [   25.834209] 
>                other info that might help us debug this:
> [   25.834970]  Possible unsafe locking scenario:
> 
> [   25.835699]        CPU0
> [   25.836077]        ----
> [   25.836459]   lock(&sb->s_type->i_mutex_key#13);
> [   25.836988]   lock(&sb->s_type->i_mutex_key#13);
> [   25.837636] 
>                 *** DEADLOCK ***
> 

The 2 attached patches should hopefully fix these 2 issues and will be
rolled into v3 together with a cleanup patch to remove the now-obsolete 
function nfs_revalidate_mapping_protected().

Cheers
  Trond
  
-- 

Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@xxxxxxxxxxxxxxx
From df4c863d69f5c333648d8c8e077f00b2cc93aadc Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Date: Wed, 22 Jun 2016 08:04:15 -0400
Subject: [PATCH 1/2] fixup! NFS: Cache aggressively when file is open for
 writing

---
 fs/nfs/inode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6bc65ffc3c6c..9521fa6154c8 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1219,8 +1219,12 @@ int nfs_revalidate_mapping_protected(struct inode *inode, struct address_space *
 
 static bool nfs_file_has_writers(struct nfs_inode *nfsi)
 {
-	assert_spin_locked(&nfsi->vfs_inode.i_lock);
+	struct inode *inode = &nfsi->vfs_inode;
 
+	assert_spin_locked(&inode->i_lock);
+
+	if (!S_ISREG(inode->i_mode))
+		return false;
 	if (list_empty(&nfsi->open_files))
 		return false;
 	/* Note: This relies on nfsi->open_files being ordered with writers
-- 
2.7.4

From 65d27ea6cc51cb653c2674666353cf3b8d0f765f Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Date: Wed, 22 Jun 2016 08:16:54 -0400
Subject: [PATCH 2/2] fixup! NFS: Do not serialise O_DIRECT reads and writes

---
 fs/nfs/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index fb7a1b0b6a20..9081afacb457 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -171,7 +171,7 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to)
 		iov_iter_count(to), (unsigned long) iocb->ki_pos);
 
 	nfs_start_io_read(inode);
-	result = nfs_revalidate_mapping_protected(inode, iocb->ki_filp->f_mapping);
+	result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
 	if (!result) {
 		result = generic_file_read_iter(iocb, to);
 		if (result > 0)
@@ -194,7 +194,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
 		filp, (unsigned long) count, (unsigned long long) *ppos);
 
 	nfs_start_io_read(inode);
-	res = nfs_revalidate_mapping_protected(inode, filp->f_mapping);
+	res = nfs_revalidate_mapping(inode, filp->f_mapping);
 	if (!res) {
 		res = generic_file_splice_read(filp, ppos, pipe, count, flags);
 		if (res > 0)
-- 
2.7.4


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux