[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0477fadd-dfb5-c581-ee6a-ed6df9a966a3@huawei.com>
Date: Mon, 10 Jan 2022 17:35:02 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: Richard Weinberger <richard@....at>
CC: Miquel Raynal <miquel.raynal@...tlin.com>,
Vignesh Raghavendra <vigneshr@...com>,
mcoquelin stm32 <mcoquelin.stm32@...il.com>,
"kirill shutemov" <kirill.shutemov@...ux.intel.com>,
Sascha Hauer <s.hauer@...gutronix.de>,
linux-mtd <linux-mtd@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v6 05/15] ubifs: Rename whiteout atomically
Hi, Richard
>
> How do you make sure the the whiteout is never written to disk (by writeback) before ubifs_jnl_rename() linked
> it? That's the reason why other filesystems use the tmpfile mechanism for whiteouts too.
>
The whiteout inode is clean after creation from create_whiteout(), and
it can't be marked dirty until ubifs_jnl_rename() finished. So, I think
there is no chance for whiteout being written on disk. Then,
'ubifs_assert(c, !whiteout_ui->dirty)' never fails in ubifs_jnl_rename()
during my local stress tests. You may add some delay executions after
whiteout creation to make sure that whiteout won't be written back
before ubifs_jnl_rename().
BTW, I considered plan B(Binding whiteout to a negative dentry), but we
cannot get parent dir's entry in do_rename(), so I abandoned it.
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1334,7 +1335,8 @@ static int do_rename(struct inode *old_dir, struct
dentry *old_dentry,
goto out_release;
}
- err = do_tmpfile(old_dir, old_dentry, S_IFCHR |
WHITEOUT_MODE, &whiteout);
+ // tmp_dentry = d_alloc(old_dir_dentry, &slash_name);
// refer to vfs_tmpfile
+ err = do_tmpfile(old_dir, tmp_dentry, S_IFCHR |
WHITEOUT_MODE, &whiteout);
if (err) {
kfree(dev);
goto out_release;
Powered by blists - more mailing lists