On Thu, 23 May 2019 at 08:05, <[1][email protected]> wrote:
Kirill Kolyshkin:
> The only way to make sure is to retry reading /proc/mounts. Or, do
> stat+statfs
> (exactly as you suggested below) to check that this is indeed the
aufs root
> directory (and then you still need to retry reading /proc/mounts).
Give me some more time about this topic.A I will consider again.
Your point is that the default value 1 for the new ProcMount_Times
doesn't help you, right?
Exactly.
A
> This is correct for read-write mounts, what about read-only ones?
For this another topic, I have a plan to introduce a new local lock.
Does this help you?
I believe it is, thank you!
A
commit 79235f42eca7a6290df1007ba786d3eb88f482e7
Author: J. R. Okajima <[2][email protected]>
Date:A A Thu May 23 23:20:21 2019 +0900
A A aufs: bugfix, protect creating XINO from concurrent mounts
A A At the mount-time, XINO files are created and removed very
soon.A When
A A multiple mounts with being given the same XINO file path
executed in
A A parallel, some of them may fail in creating XINO due to
EEXIST.
A A Introducing a local mutex, put it in a critical region.
A A Obviously this is unnecessary overhead when the XINO file path
is not
A A same, and such lock should be done by inode_lock() for the
parent dir.
A A Actually au_xino_create2() behaves in this way.A Then why
didn't I apply
A A the same way to this au_xino_create()?A It is just my
laziness.A Calling
A A VFS filp_open() here is easy for me.
A A Reported-by: Kirill Kolyshkin <[3][email protected]>
A A Signed-off-by: J. R. Okajima <[4][email protected]>
diff --git a/fs/aufs/xino.c b/fs/aufs/xino.c
index 74682b6a97eb..7de402b3bc34 100644
--- a/fs/aufs/xino.c
+++ b/fs/aufs/xino.c
@@ -153,16 +153,19 @@ struct file *au_xino_create(struct super_block
*sb, char *fpath, int silent)
A A A A struct dentry *h_parent, *d;
A A A A struct inode *h_dir, *inode;
A A A A int err;
+A A A A static DEFINE_MUTEX(mtx);
A A A A /*
A A A A A * at mount-time, and the xino file is the default
path,
A A A A A * hnotify is disabled so we have no notify events to
ignore.
A A A A A * when a user specified the xino, we cannot get
au_hdir to be ignored.
A A A A A */
+A A A A mutex_lock(&mtx);
A A A A file = vfsub_filp_open(fpath, O_RDWR | O_CREAT | O_EXCL
| O_LARGEFILE
A A A A A A A A A A A A A A A A /* | __FMODE_NONOTIFY
*/,
A A A A A A A A A A A A A A A A 0666);
A A A A if (IS_ERR(file)) {
+A A A A A A A A mutex_unlock(&mtx);
A A A A A A A A if (!silent)
A A A A A A A A A A A A pr_err("open %s(%ld)\n", fpath,
PTR_ERR(file));
A A A A A A A A return file;
@@ -172,6 +175,7 @@ struct file *au_xino_create(struct super_block
*sb, char *fpath, int silent)
A A A A err = 0;
A A A A d = file->f_path.dentry;
A A A A h_parent = au_dget_parent_lock(d, AuLsc_I_PARENT);
+A A A A mutex_unlock(&mtx);
A A A A /* mnt_want_write() is unnecessary here */
A A A A h_dir = d_inode(h_parent);
A A A A inode = file_inode(file);
References
1. mailto:[email protected]
2. mailto:[email protected]
3. mailto:[email protected]
4. mailto:[email protected]