[PATCH 02/27] allow hard links to directories, opt-in for any filesystem
- From: "Joshua Hudson" <joshudson@xxxxxxxxx>
- Date: Mon, 27 Feb 2006 22:04:01 -0800
Patch seems to work, might want more testing.
It probably should not be applied without a discussion, especially
as no filesystem in kernel tree wants this. I am working on a fs that does.
---
--- include/linux/fs.orig.h 2006-02-27 21:45:26.000000000 -0800
+++ include/linux/fs.h 2006-02-27 21:48:17.000000000 -0800
@@ -83,6 +83,8 @@
/* public flags for file_system_type */
#define FS_REQUIRES_DEV 1
#define FS_BINARY_MOUNTDATA 2
+#define FS_ALLOW_HLINK_DIR 4 /* FS will accept hard links to directories */
+#define FS_ALLOW_USER_HLINK_DIR 8 /* And it makes sense for regular users */
#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
#define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon
* as nfs_rename() will be cleaned up
--- fs/namei.c.orig 2006-02-27 21:55:26.000000000 -0800
+++ fs/namei.c 2006-02-27 22:08:27.000000000 -0800
@@ -2107,7 +2107,14 @@
if (!dir->i_op || !dir->i_op->link)
return -EPERM;
if (S_ISDIR(old_dentry->d_inode->i_mode))
- return -EPERM;
+ {
+ if (!(old_dentry->d_sb->s_type->fs_flags & FS_ALLOW_HLINK_DIR))
+ return -EPERM;
+ if (!(old_dentry->d_sb->s_type->fs_flags
+ & FS_ALLOW_USER_HLINK_DIR)
+ && !capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ }
error = security_inode_link(old_dentry, dir, new_dentry);
if (error)
-
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/
- Follow-Ups:
- Prev by Date: hugepage: Serialize hugepage allocation and instantiation
- Next by Date: ACE Check Express Inc. has immediate work for Australian and New Zealand citizens
- Previous by thread: hugepage: Serialize hugepage allocation and instantiation
- Next by thread: Re: [PATCH 02/27] allow hard links to directories, opt-in for any filesystem
- Index(es):
Relevant Pages
- [PATCH 2.6.11.4 1/1] fs: new filesystem implementation VXEXT1.0
... a new filesystem implementation in the misc section of the kernel tree. ...
The VXEXT filesystem is more or less a FAT16 based filesystem which was ... Please find
the patch file accessible through the following URL: ... (Linux-Kernel) - Re: [PATCH 1/2] batch-write.patch
... This patch adds a method batch_write to struct address_space_operations. ...
A filesystem may want to implement this operation to improve write performance. ... Please
read the FAQ at http://www.tux.org/lkml/ ... (Linux-Kernel) - Re: [PATCH] Add nid sanity on alloc_pages_node
... Patch gone too;) I deleted it. ... finished product. ... cannot
found it at 2.6.22 kernel tree, I think you must use difference kernel ... Please read
the FAQ at http://www.tux.org/lkml/ ... (Linux-Kernel) - Re: [PATCH 04/24] r/o bind mounts: stub functions
... This patch adds two function mnt_want_writeand ... These are used like a lock
pair around ... and fs operations that might cause a write to the filesystem. ...
Please read the FAQ at http://www.tux.org/lkml/ ... (Linux-Kernel) - [PATCH 2.6.0-test5 latest bk]mqueue filesystem
... changes in 2.6.0-test4 caused your patch to no longer build. ... I have been
hammering the hell out of this filesystem ... POSIX message queues fs ...
+static int proc_write_max_queues(struct file *file, ... (Linux-Kernel)