[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47685054.6080603@rtr.ca>
Date: Tue, 18 Dec 2007 17:57:24 -0500
From: Mark Lord <lkml@....ca>
To: Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: RFC: permit link(2) to work across --bind mounts ?
Mark Lord wrote:
> Why does link(2) not support hard-linking across bind mount points
> of the same underlying filesystem ?
>
> Is it as simple as something like this patch below (minus the printk)?
> Not likely, but then I'm not a filesystem guru.
>
> ???
>
> --- old/fs/namei.c 2007-12-15 12:33:13.000000000 -0500
> +++ linux/fs/namei.c 2007-12-18 17:37:04.000000000 -0500
> @@ -2398,8 +2398,11 @@
> if (error)
> goto out;
> error = -EXDEV;
> - if (old_nd.mnt != nd.mnt)
> - goto out_release;
> + if (old_nd.mnt != nd.mnt) {
> + if (old_nd.mnt->mnt_sb != nd.mnt->mnt_sb)
> + goto out_release;
> + printk("sys_linkat: old_nd.mnt != nd.mnt, but sb is the same.
> Continuing..\n");
> + }
> new_dentry = lookup_create(&nd, 0);
> error = PTR_ERR(new_dentry);
> if (IS_ERR(new_dentry))
..
The patch seems to work for me after some light testing on ext3 here.
But I have no idea about other filesystems, or if there's some kind of
race condition or something. Or maybe we just never bothered ?
Cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists