Re: [PATCH -V20 03/12] vfs: Add open by file handle support

From: Aneesh Kumar K. V
Date: Wed Sep 29 2010 - 01:27:24 EST


On Wed, 29 Sep 2010 01:06:41 +0530, "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxxxxxxx> wrote:
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
> ---
> fs/compat.c | 11 +++
> fs/exportfs/expfs.c | 2 +
> fs/namei.c | 223 +++++++++++++++++++++++++++++++++++++++++++---
> fs/open.c | 32 ++++++-
> include/linux/fs.h | 10 ++-
> include/linux/namei.h | 1 +
> include/linux/syscalls.h | 3 +
> 7 files changed, 263 insertions(+), 19 deletions(-)
>
> diff --git a/fs/compat.c b/fs/compat.c
> index 0644a15..4a423fa 100644
> --- a/fs/compat.c
> +++ b/fs/compat.c
> @@ -2334,3 +2334,14 @@ asmlinkage long compat_sys_timerfd_gettime(int ufd,
> }
>
> #endif /* CONFIG_TIMERFD */
> +
> +/*
> + * Exactly like fs/open.c:sys_open_by_handle_at(), except that it
> + * doesn't set the O_LARGEFILE flag.
> + */
> +asmlinkage long
> +compat_sys_open_by_handle_at(int mountdirfd,
> + struct file_handle __user *handle, int flags)
> +{
> + return do_handle_open(mountdirfd, handle, flags);
> +}
> diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
> index cfee0f0..05a1179 100644
> --- a/fs/exportfs/expfs.c
> +++ b/fs/exportfs/expfs.c
> @@ -373,6 +373,8 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
> /*
> * Try to get any dentry for the given file handle from the filesystem.
> */
> + if (!nop || !nop->fh_to_dentry)
> + return ERR_PTR(-ESTALE);
> result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type);
> if (!result)
> result = ERR_PTR(-ESTALE);
> diff --git a/fs/namei.c b/fs/namei.c
> index 24896e8..3439962 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -32,6 +32,7 @@
> #include <linux/fcntl.h>
> #include <linux/device_cgroup.h>
> #include <linux/fs_struct.h>
> +#include <linux/exportfs.h>
> #include <asm/uaccess.h>
>
> #include "internal.h"
> @@ -1050,6 +1051,29 @@ out_fail:
> return retval;
> }
>
> +struct vfsmount *get_vfsmount_from_fd(int fd)
> +{
> + int fput_needed;
> + struct path path;
> + struct file *filep;
> +
> + if (fd == AT_FDCWD) {
> + struct fs_struct *fs = current->fs;
> + spin_lock(&fs->lock);
> + path = fs->pwd;
> + mntget(path.mnt);
> + spin_lock(&fs->lock);

That should be spin_unlock. A missing stg refresh before sending the
patch series.

-aneesh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/