2005-01-26 23:18:15

by Miklos Szeredi

[permalink] [raw]
Subject: [PATCH] FUSE - fix hard link operation

Andrew,

This patch fixes a bug in link, where the wrong inode number was
passed to userspace as the link source.

Needs update to fuse library to 2.2-pre6 as well.

Please apply.

Thanks,
Miklos

Signed-off-by: Miklos Szeredi <[email protected]>

diff -rup linux-2.6.11-rc2-mm1/fs/fuse/dir.c linux-fuse/fs/fuse/dir.c
--- linux-2.6.11-rc2-mm1/fs/fuse/dir.c 2005-01-26 18:30:47.000000000 +0100
+++ linux-fuse/fs/fuse/dir.c 2005-01-26 18:18:58.000000000 +0100
@@ -360,9 +360,9 @@ static int fuse_link(struct dentry *entr
return -ERESTARTNOINTR;

memset(&inarg, 0, sizeof(inarg));
- inarg.newdir = get_node_id(newdir);
+ inarg.oldnodeid = get_node_id(inode);
req->in.h.opcode = FUSE_LINK;
- req->inode2 = newdir;
+ req->inode2 = inode;
req->in.numargs = 2;
req->in.args[0].size = sizeof(inarg);
req->in.args[0].value = &inarg;
diff -rup linux-2.6.11-rc2-mm1/include/linux/fuse.h linux-fuse/include/linux/fuse.h
--- linux-2.6.11-rc2-mm1/include/linux/fuse.h 2005-01-26 18:30:53.000000000 +0100
+++ linux-fuse/include/linux/fuse.h 2005-01-26 18:18:58.000000000 +0100
@@ -133,7 +133,7 @@ struct fuse_rename_in {
};

struct fuse_link_in {
- __u64 newdir;
+ __u64 oldnodeid;
};

struct fuse_setattr_in {