[PATCH 05/16] vfs: Allow unlink, and rename on expirable file mounts

From: Eric W. Biederman
Date: Fri Apr 15 2016 - 11:48:55 EST


This is motivated by /dev/ptmx now being an automount. Given that
automounts eventually will go away I don't see that there is a point
in making unlink and rename to wait until the automounts actually go
away before allowing an operation.

Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
---
fs/namespace.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 714778360c2b..278ecb7b8e8e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -718,8 +718,14 @@ bool __is_local_mountpoint(struct dentry *dentry)
down_read(&namespace_sem);
list_for_each_entry(mnt, &ns->list, mnt_list) {
is_covered = (mnt->mnt_mountpoint == dentry);
- if (is_covered)
+ if (is_covered) {
+ if (!d_is_dir(dentry) &&
+ (mnt->mnt.mnt_flags & MNT_SHRINKABLE)) {
+ is_covered = false;
+ continue;
+ }
break;
+ }
}
up_read(&namespace_sem);
out:
--
2.8.1