diff mbox

[xenial] UBUNTU: SAUCE: fs: Allow psuedo-fs superblocks to be reused in other namespaces

Message ID 1456254303-68512-1-git-send-email-seth.forshee@canonical.com
State New
Headers show

Commit Message

Seth Forshee Feb. 23, 2016, 7:05 p.m. UTC
For psuedo filesystems it's not critical that s_user_ns match the
user namespace where the superblock is being mounted, and this
check is currently breaking cgroup namespaces. Skip the check
for psuedo filesystems.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 fs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Serge E. Hallyn Feb. 23, 2016, 7:15 p.m. UTC | #1
Quoting Seth Forshee (seth.forshee@canonical.com):
> For psuedo filesystems it's not critical that s_user_ns match the
> user namespace where the superblock is being mounted, and this
> check is currently breaking cgroup namespaces. Skip the check
> for psuedo filesystems.
> 
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>

Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>

> ---
>  fs/super.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index 732bffa..1f2bfd7 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -471,7 +471,8 @@ retry:
>  		hlist_for_each_entry(old, &type->fs_supers, s_instances) {
>  			if (!test(old, data))
>  				continue;
> -			if (user_ns != old->s_user_ns) {
> +			if ((type->fs_flags & FS_REQUIRES_DEV) &&
> +			    user_ns != old->s_user_ns) {
>  				spin_unlock(&sb_lock);
>  				return ERR_PTR(-EBUSY);
>  			}
> -- 
> 1.9.1
>
Stefan Bader Feb. 24, 2016, 4:17 p.m. UTC | #2
Think it does what it say and assuming it was tested. Though its not strictly
required, was there a bug report one could refer to?

-Stefan

On 23.02.2016 20:05, Seth Forshee wrote:
> For psuedo filesystems it's not critical that s_user_ns match the
> user namespace where the superblock is being mounted, and this
> check is currently breaking cgroup namespaces. Skip the check
> for psuedo filesystems.
> 
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> ---
>  fs/super.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/super.c b/fs/super.c
> index 732bffa..1f2bfd7 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -471,7 +471,8 @@ retry:
>  		hlist_for_each_entry(old, &type->fs_supers, s_instances) {
>  			if (!test(old, data))
>  				continue;
> -			if (user_ns != old->s_user_ns) {
> +			if ((type->fs_flags & FS_REQUIRES_DEV) &&
> +			    user_ns != old->s_user_ns) {
>  				spin_unlock(&sb_lock);
>  				return ERR_PTR(-EBUSY);
>  			}
>
Seth Forshee Feb. 24, 2016, 5:25 p.m. UTC | #3
On Tue, Feb 23, 2016 at 01:05:03PM -0600, Seth Forshee wrote:
> For psuedo filesystems it's not critical that s_user_ns match the
> user namespace where the superblock is being mounted, and this
> check is currently breaking cgroup namespaces. Skip the check
> for psuedo filesystems.

I've found a solution I like better. I'll send a new patch momentarily.
diff mbox

Patch

diff --git a/fs/super.c b/fs/super.c
index 732bffa..1f2bfd7 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -471,7 +471,8 @@  retry:
 		hlist_for_each_entry(old, &type->fs_supers, s_instances) {
 			if (!test(old, data))
 				continue;
-			if (user_ns != old->s_user_ns) {
+			if ((type->fs_flags & FS_REQUIRES_DEV) &&
+			    user_ns != old->s_user_ns) {
 				spin_unlock(&sb_lock);
 				return ERR_PTR(-EBUSY);
 			}