From: asmadeus@codewreck.org
To: Eric Van Hensbergen <ericvh@kernel.org>
Cc: v9fs-developer@lists.sourceforge.net, rminnich@gmail.com,
lucho@ionkov.net, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux_oss@crudebyte.com
Subject: Re: [PATCH v4 10/11] fs/9p: writeback mode fixes
Date: Sat, 18 Feb 2023 21:15:33 +0900 [thread overview]
Message-ID: <Y/DBZSaAsRiNR2WV@codewreck.org> (raw)
In-Reply-To: <Y/Ch8o/6HVS8Iyeh@codewreck.org>
asmadeus@codewreck.org wrote on Sat, Feb 18, 2023 at 07:01:22PM +0900:
> > diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
> > index 5fc6a945bfff..797f717e1a91 100644
> > --- a/fs/9p/vfs_super.c
> > +++ b/fs/9p/vfs_super.c
>
> > @@ -323,16 +327,17 @@ static int v9fs_write_inode_dotl(struct inode *inode,
> > */
> > v9inode = V9FS_I(inode);
> > p9_debug(P9_DEBUG_VFS, "%s: inode %p, writeback_fid %p\n",
> > - __func__, inode, v9inode->writeback_fid);
> > - if (!v9inode->writeback_fid)
> > - return 0;
> > + __func__, inode, fid);
> > + if (!fid)
> > + return -EINVAL;
>
> Hmm, what happens if we return EINVAL here?
> Might want a WARN_ONCE or something?
Answering myself on this: No idea what happens, but it's fairly
common...
(I saw it from wb_writeback which considers any non-zero return value as
'progress', so the error is progress as well... Might make more sense to
return 0 here actually? need more thorough checking, didn't take time to
dig through this either...)
That aside I ran with my comments addressed and cache=fscache, and
things blew up during ./configure of coreutils-9.1 in qemu:
(I ran it as root without setting the env var so it failed, that much is
expected -- the evict_inode blowing up isn't)
-------
checking whether mknod can create fifo without root privileges... configure: error: in `/mnt/coreutils-9.1':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details
FS-Cache:
FS-Cache: Assertion failed
FS-Cache: 2 == 0 is false
------------[ cut here ]------------
kernel BUG at fs/fscache/cookie.c:985!
invalid opcode: 0000 [#3] SMP PTI
CPU: 0 PID: 9707 Comm: rm Tainted: G D 6.2.0-rc2+ #37
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014
RIP: 0010:__fscache_relinquish_cookie.cold+0x5a/0x8f
Code: 48 c7 c7 21 5e b8 81 e8 34 87 ff ff 48 c7 c7 2f 5e b8 81 e8 28 87 ff ff 48 63 73 04 31 d2 48 c7 c7 00 61 b8 81 e8 16 87 ff ff <0f> 0b 44 8b 47 04 8b 4f 0c 45 0f b8
RSP: 0018:ffffc90002697e08 EFLAGS: 00010286
RAX: 0000000000000019 RBX: ffff8880077de210 RCX: 00000000ffffefff
RDX: 00000000ffffffea RSI: 00000000ffffefff RDI: 0000000000000001
RBP: ffffc90002697e18 R08: 0000000000004ffb R09: 00000000ffffefff
R10: ffffffff8264ea20 R11: ffffffff8264ea20 R12: 0000000000000000
R13: ffffffffc00870e0 R14: ffff88800308cd20 R15: ffff8880046a0020
FS: 00007fec5aa33000(0000) GS:ffff88807cc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000009af4d8 CR3: 0000000007490000 CR4: 00000000000006b0
Call Trace:
<TASK>
v9fs_evict_inode+0x78/0x90 [9p]
evict+0xc0/0x160
iput+0x171/0x220
do_unlinkat+0x197/0x280
__x64_sys_unlinkat+0x37/0x60
do_syscall_64+0x3c/0x80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fec5ab33fdb
Code: 73 01 c3 48 8b 0d 55 9e 0f 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 07 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 08
RSP: 002b:00007ffd460b1858 EFLAGS: 00000246 ORIG_RAX: 0000000000000107
RAX: ffffffffffffffda RBX: 00000000009af830 RCX: 00007fec5ab33fdb
RDX: 0000000000000000 RSI: 00000000009ae3d0 RDI: 00000000ffffff9c
RBP: 00000000009ae340 R08: 0000000000000003 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd460b1a40 R14: 0000000000000000 R15: 00000000009af830
</TASK>
Modules linked in: 9pnet_virtio 9p 9pnet siw ib_core
---[ end trace 0000000000000000 ]---
RIP: 0010:__fscache_relinquish_cookie.cold+0x5a/0x8f
Code: 48 c7 c7 21 5e b8 81 e8 34 87 ff ff 48 c7 c7 2f 5e b8 81 e8 28 87 ff ff 48 63 73 04 31 d2 48 c7 c7 00 61 b8 81 e8 16 87 ff ff <0f> 0b 44 8b 47 04 8b 4f 0c 45 0f b8
RSP: 0018:ffffc90002237e08 EFLAGS: 00010286
RAX: 0000000000000019 RBX: ffff8880077de9a0 RCX: 00000000ffffefff
RDX: 00000000ffffffea RSI: 00000000ffffefff RDI: 0000000000000001
RBP: ffffc90002237e18 R08: 0000000000004ffb R09: 00000000ffffefff
R10: ffffffff8264ea20 R11: ffffffff8264ea20 R12: 0000000000000000
R13: ffffffffc00870e0 R14: ffff888003a6b500 R15: ffff8880046a0020
FS: 00007fec5aa33000(0000) GS:ffff88807cc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000009af4d8 CR3: 0000000007490000 CR4: 00000000000006b0
./configure: line 88: 9707 Segmentation fault exit $1
-----------
I don't have time to investigate but I'm afraid this needs a bit more
time as well, sorry :/
For reference, here's how I addressed my comments. I don't think that's
related to the problem at hand but can retry later without it if you
think something's fishy:
---------
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 44918c60357f..c16c39ba55d6 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -215,7 +215,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n",
inode, filp, fid ? fid->fid : -1);
if (fid) {
- if ((fid->qid.type == P9_QTFILE) && (filp->f_mode & FMODE_WRITE))
+ if ((S_ISREG(inode->i_mode)) && (filp->f_mode & FMODE_WRITE))
v9fs_flush_inode_writeback(inode);
spin_lock(&inode->i_lock);
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 936daff9f948..e322d4196be6 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -60,7 +60,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
return PTR_ERR(fid);
if ((v9ses->cache >= CACHE_WRITEBACK) && (omode & P9_OWRITE)) {
- int writeback_omode = (omode & !P9_OWRITE) | P9_ORDWR;
+ int writeback_omode = (omode & ~P9_OWRITE) | P9_ORDWR;
p9_debug(P9_DEBUG_CACHE, "write-only file with writeback enabled, try opening O_RDWR\n");
err = p9_client_open(fid, writeback_omode);
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index d53475e1ba27..062c34524b1f 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -230,22 +230,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
int v9fs_flush_inode_writeback(struct inode *inode)
{
- struct writeback_control wbc = {
- .nr_to_write = LONG_MAX,
- .sync_mode = WB_SYNC_ALL,
- .range_start = 0,
- .range_end = -1,
- };
-
- int retval = filemap_fdatawrite_wbc(inode->i_mapping, &wbc);
-
- if (retval != 0) {
- p9_debug(P9_DEBUG_ERROR,
- "trying to flush inode %p failed with error code %d\n",
- inode, retval);
- }
-
- return retval;
+ return filemap_write_and_wait(inode->i_mapping);
}
/**
------
--
Dominique
next prev parent reply other threads:[~2023-02-18 12:16 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221217183142.1425132-1-evanhensbergen@icloud.com>
2022-12-18 23:22 ` [PATCH v2 00/10] Performance fixes for 9p filesystem Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 01/10] Adjust maximum MSIZE to account for p9 header Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 02/10] Expand setup of writeback cache to all levels Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 03/10] Consolidate file operations and add readahead and writeback Eric Van Hensbergen
2023-01-24 2:43 ` asmadeus
2023-01-24 3:03 ` Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 04/10] Remove unnecessary superblock flags Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 05/10] allow disable of xattr support on mount Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 06/10] fix bug in client create for .L Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 07/10] Add additional debug flags and open modes Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 08/10] Add new mount modes Eric Van Hensbergen
2023-01-24 3:35 ` Amir Goldstein
2022-12-18 23:22 ` [PATCH v2 09/10] fix error reporting in v9fs_dir_release Eric Van Hensbergen
2022-12-18 23:22 ` [PATCH v2 10/10] writeback mode fixes Eric Van Hensbergen
2023-01-23 16:31 ` [PATCH v2 00/10] Performance fixes for 9p filesystem Christian Schoenebeck
2023-01-24 2:33 ` evanhensbergen
2023-01-24 2:49 ` asmadeus
2023-01-24 2:38 ` [PATCH v3 00/11] " Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 01/11] Adjust maximum MSIZE to account for p9 header Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 02/11] Expand setup of writeback cache to all levels Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 03/11] Consolidate file operations and add readahead and writeback Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 04/11] Remove unnecessary superblock flags Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 05/11] allow disable of xattr support on mount Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 06/11] fix bug in client create for .L Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 07/11] Add additional debug flags and open modes Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 08/11] Add new mount modes Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 09/11] fix error reporting in v9fs_dir_release Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 10/11] writeback mode fixes Eric Van Hensbergen
2023-01-24 2:38 ` [PATCH v3 11/11] Fix revalidate Eric Van Hensbergen
2023-02-02 11:27 ` [PATCH v3 00/11] Performance fixes for 9p filesystem Christian Schoenebeck
2023-02-03 19:12 ` Eric Van Hensbergen
2023-02-04 13:40 ` Christian Schoenebeck
2023-02-04 21:38 ` Eric Van Hensbergen
2023-02-05 16:37 ` Eric Van Hensbergen
2023-02-06 13:20 ` Christian Schoenebeck
2023-02-06 13:37 ` Eric Van Hensbergen
2023-02-18 0:33 ` [PATCH v4 " Eric Van Hensbergen
2023-02-18 0:33 ` [PATCH v4 01/11] net/9p: Adjust maximum MSIZE to account for p9 header Eric Van Hensbergen
2023-02-18 7:50 ` asmadeus
2023-02-18 0:33 ` [PATCH v4 02/11] fs/9p: Expand setup of writeback cache to all levels Eric Van Hensbergen
2023-02-18 8:57 ` asmadeus
2023-02-18 0:33 ` [PATCH v4 03/11] fs/9p: Consolidate file operations and add readahead and writeback Eric Van Hensbergen
2023-02-18 9:24 ` asmadeus
2023-02-18 16:17 ` Eric Van Hensbergen
2023-02-18 16:19 ` Eric Van Hensbergen
2023-02-18 20:35 ` asmadeus
2023-02-27 2:50 ` [PATCH v5 3/11] " Eric Van Hensbergen
2023-02-18 0:33 ` [PATCH v4 04/11] fs/9p: Remove unnecessary superblock flags Eric Van Hensbergen
2023-02-18 9:33 ` asmadeus
2023-02-18 16:24 ` Eric Van Hensbergen
2023-02-18 20:30 ` asmadeus
2023-02-18 0:33 ` [PATCH v4 05/11] fs/9p: allow disable of xattr support on mount Eric Van Hensbergen
2023-02-18 7:52 ` asmadeus
2023-02-18 0:33 ` [PATCH v4 06/11] net/9p: fix bug in client create for .L Eric Van Hensbergen
2023-02-18 8:01 ` asmadeus
2023-02-18 0:33 ` [PATCH v4 07/11] 9p: Add additional debug flags and open modes Eric Van Hensbergen
2023-02-18 8:05 ` asmadeus
2023-02-27 2:53 ` [PATCH v5 7/11] " Eric Van Hensbergen
2023-02-18 0:33 ` [PATCH v4 08/11] fs/9p: Add new mount modes Eric Van Hensbergen
2023-02-18 8:46 ` asmadeus
2023-02-27 2:55 ` [PATCH v5 8/11] " Eric Van Hensbergen
2023-02-18 0:33 ` [PATCH v4 09/11] fs/9p: fix error reporting in v9fs_dir_release Eric Van Hensbergen
2023-02-18 8:49 ` asmadeus
2023-02-18 0:33 ` [PATCH v4 10/11] fs/9p: writeback mode fixes Eric Van Hensbergen
2023-02-18 8:38 ` asmadeus
2023-02-18 10:01 ` asmadeus
2023-02-18 12:15 ` asmadeus [this message]
2023-02-18 16:40 ` Eric Van Hensbergen
2023-02-18 20:29 ` asmadeus
2023-03-21 1:12 ` Eric Van Hensbergen
2023-02-18 19:58 ` Christian Schoenebeck
2023-02-18 22:24 ` Eric Van Hensbergen
2023-02-18 23:40 ` asmadeus
2023-02-18 23:52 ` Eric Van Hensbergen
2023-03-27 2:59 ` [PATCH v5] fs/9p: remove writeback fid and fix per-file modes Eric Van Hensbergen
2023-04-25 7:11 ` Christophe JAILLET
2023-04-25 11:13 ` asmadeus
2023-04-26 0:01 ` Eric Van Hensbergen
2023-02-18 0:33 ` [PATCH v4 11/11] fs/9p: Fix revalidate Eric Van Hensbergen
2023-02-18 8:55 ` asmadeus
2023-02-18 7:48 ` [PATCH v4 00/11] Performance fixes for 9p filesystem asmadeus
2023-02-19 21:36 ` Christian Schoenebeck
2023-02-20 1:13 ` Eric Van Hensbergen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/DBZSaAsRiNR2WV@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=rminnich@gmail.com \
--cc=v9fs-developer@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).