alhafoudh/fdlink — Issue #4: Does not work with new kernels
Author: benibela
Created: 2012-03-09 21:47:58+00:00
State: open

It doesn't work with new kernels (e.g. 3.2.0-2-amd64).

I think these changes fix it:

--- flink_dev.c.old	2012-03-09 22:47:45.000000000 +0100
+++ flink_dev.c.new	2012-03-09 22:47:33.000000000 +0100
@@ -41,7 +41,7 @@
old_dentry = f->f_dentry;
error = 0;

-	error = path_lookup(to, LOOKUP_PARENT, &nd);
+	error = kern_path(to, LOOKUP_PARENT, &nd);
if (error)
goto release_f;

@@ -49,7 +49,8 @@
if (f->f_vfsmnt != nd.path.mnt)
goto release_nd;

-	new_dentry = lookup_create(&nd, 0);
+	struct path unused;
+	new_dentry = kern_path_create(AT_FDCWD, to, &unused, 0);
error = PTR_ERR(new_dentry);
if (!IS_ERR(new_dentry)) {
error = vfs_link(old_dentry, nd.path.dentry->d_inode, new_dentry);