vfs: finish rename -> rename2 conversion
Subsystems (40)
cover vfs: finish rename -> rename2 conversion
This series gets rid of the duplicate interfaces for rename. The only difference between the two that the new, i_op->rename2() has an added flags argument. This needs to be handled in each instance.
For 21 local filesystems the RENAME_NOREPLACE flag can be supported "for free", just by moving to the new interface and allowing this flag. The remaining 12 distributed filesystems are converted too, which only allow zero flags.
Git tree is here.
git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git#rename2
Thanks,
Miklos
---
Miklos Szeredi (7):
ncpfs: fix unused variable warning
fs: support RENAME_NOREPLACE for local filesystems
libfs: support RENAME_NOREPLACE in simple_rename()
fs: make remaining filesystems use .rename2
vfs: remove unused i_op->rename
fs: rename "rename2" i_op to "rename"
vfs: add note about i_op->rename changes to porting
Documentation/filesystems/Locking | 8 ++------ Documentation/filesystems/directory-locking | 2 +- Documentation/filesystems/porting | 4 ++++ Documentation/filesystems/vfs.txt | 9 ++------- drivers/staging/lustre/lustre/llite/namei.c | 8 ++++++-- fs/9p/v9fs.h | 3 ++- fs/9p/vfs_inode.c | 6 +++++- fs/affs/affs.h | 3 ++- fs/affs/namei.c | 6 +++++- fs/afs/dir.c | 9 +++++++-- fs/bad_inode.c | 2 +- fs/bfs/dir.c | 6 +++++- fs/btrfs/inode.c | 2 +- fs/cachefiles/namei.c | 3 +-- fs/ceph/dir.c | 6 +++++- fs/cifs/cifsfs.c | 2 +- fs/coda/dir.c | 6 +++++- fs/debugfs/inode.c | 2 +- fs/ecryptfs/inode.c | 6 +++++- fs/exofs/namei.c | 8 ++++++-- fs/ext2/namei.c | 6 +++++- fs/ext4/namei.c | 2 +- fs/f2fs/namei.c | 2 +- fs/fat/namei_msdos.c | 6 +++++- fs/fat/namei_vfat.c | 6 +++++- fs/fuse/dir.c | 2 +- fs/gfs2/inode.c | 2 +- fs/hfs/dir.c | 6 +++++- fs/hfsplus/dir.c | 6 +++++- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/namei.c | 6 +++++- fs/jffs2/dir.c | 9 +++++++-- fs/jfs/namei.c | 5 ++++- fs/kernfs/dir.c | 6 +++++- fs/libfs.c | 6 +++++- fs/logfs/dir.c | 6 +++++- fs/minix/namei.c | 6 +++++- fs/namei.c | 15 +++------------ fs/ncpfs/dir.c | 11 +++++++---- fs/nfs/dir.c | 6 +++++- fs/nfs/internal.h | 3 ++- fs/nilfs2/namei.c | 6 +++++- fs/ocfs2/namei.c | 6 +++++- fs/omfs/dir.c | 6 +++++- fs/orangefs/namei.c | 6 +++++- fs/overlayfs/dir.c | 2 +- fs/overlayfs/overlayfs.h | 4 ++-- fs/reiserfs/namei.c | 6 +++++- fs/sysv/namei.c | 6 +++++- fs/ubifs/dir.c | 8 ++++++-- fs/udf/namei.c | 6 +++++- fs/ufs/namei.c | 6 +++++- fs/xfs/xfs_iops.c | 4 ++-- include/linux/fs.h | 5 ++--- mm/shmem.c | 2 +- security/tomoyo/realpath.c | 4 ++-- 56 files changed, 206 insertions(+), 91 deletions(-)
Signature · 1 line
2.5.5
PATCH 1/7 ncpfs: fix unused variable warning
Without CONFIG_NCPFS_NLS the following warning is seen:
fs/ncpfs/dir.c: In function 'ncp_hash_dentry':fs/ncpfs/dir.c:136:23: warning: unused variable 'sb' [-Wunused-variable]
struct super_block *sb = dentry->d_sb;
--- fs/ncpfs/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ncpfs/dir.c +1 -2
@@ -133,12 +133,11 @@ ncp_hash_dentry(const struct dentry *dentry, struct qstr *this)return 0 ;if (!ncp_case_sensitive (inode)) { -struct super_block *sb = dentry->d_sb;struct nls_table *t;unsigned long hash;int i; - t =NCP_IO_TABLE (sb); + t =NCP_IO_TABLE (dentry->d_sb); hash =init_name_hash (dentry);for (i=0 ; i<this->len ; i++) hash = partial_name_hash(ncp_tolower(t, this->name[i]),
Signature · 1 line
2.5.5
PATCH 2/7 fs: support RENAME_NOREPLACE for local filesystems
In reply to Miklos SzerediThis is trivial to do:
- add flags argument to foo_rename()
- check if flags doesn't have any other than RENAME_NOREPLACE
- assign foo_rename() to .rename2 instead of .rename
Filesystems converted:
affs, bfs, ext2, hfs, hfsplus, jffs2, jfs, logfs, minix, msdos, nilfs2, omfs, reiserfs, sysvfs, ubifs, udf, ufs, vfat.
--- fs/affs/affs.h | 3 ++- fs/affs/dir.c | 2 +- fs/affs/namei.c | 6 +++++- fs/bfs/dir.c | 8 ++++++-- fs/ext2/namei.c | 8 ++++++-- fs/fat/namei_msdos.c | 8 ++++++-- fs/fat/namei_vfat.c | 8 ++++++-- fs/hfs/dir.c | 8 ++++++-- fs/hfsplus/dir.c | 8 ++++++-- fs/hpfs/namei.c | 8 ++++++-- fs/jffs2/dir.c | 11 ++++++++--- fs/jfs/namei.c | 7 +++++-- fs/logfs/dir.c | 8 ++++++-- fs/minix/namei.c | 8 ++++++-- fs/nilfs2/namei.c | 8 ++++++-- fs/omfs/dir.c | 8 ++++++-- fs/reiserfs/namei.c | 8 ++++++-- fs/sysv/namei.c | 8 ++++++-- fs/ubifs/dir.c | 8 ++++++-- fs/udf/namei.c | 8 ++++++-- fs/ufs/namei.c | 8 ++++++-- 21 files changed, 117 insertions(+), 40 deletions(-)
fs/affs/affs.h +2 -1
@@ -173,7 +173,8 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,extern int affs_symlink (struct inode *dir,struct dentry *dentry,const char *symname);extern int affs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry); +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags);/* inode.c */
fs/affs/dir.c +1 -1
@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = { .symlink = affs_symlink, .mkdir = affs_mkdir, .rmdir = affs_rmdir, - .rename = affs_rename, + .rename2 = affs_rename, .setattr = affs_notify_change, };
fs/affs/namei.c +5 -1
@@ -414,12 +414,16 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)int affs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct super_block *sb = old_dir->i_sb;struct buffer_head *bh =NULL ;int retval; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +pr_debug ("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n" , __func__, old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
fs/bfs/dir.c +6 -2
@@ -207,7 +207,8 @@ out_brelse: }static int bfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode, *new_inode;struct buffer_head *old_bh, *new_bh;
@@ -215,6 +216,9 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct bfs_sb_info *info;int error = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_bh = new_bh =NULL ; old_inode =d_inode (old_dentry);if (S_ISDIR (old_inode->i_mode))
@@ -270,7 +274,7 @@ const struct inode_operations bfs_dir_inops = { .lookup = bfs_lookup, .link = bfs_link, .unlink = bfs_unlink, - .rename = bfs_rename, + .rename2 = bfs_rename, }; static int bfs_add_entry(struct inode *dir, const unsigned char *name,
fs/ext2/namei.c +6 -2
@@ -328,7 +328,8 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry) }static int ext2_rename (struct inode * old_dir,struct dentry * old_dentry, -struct inode * new_dir,struct dentry * new_dentry ) +struct inode * new_dir,struct dentry * new_dentry, +unsigned int flags) {struct inode * old_inode =d_inode (old_dentry);struct inode * new_inode =d_inode (new_dentry);
@@ -338,6 +339,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,struct ext2_dir_entry_2 * old_de;int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + err =dquot_initialize (old_dir);if (err) goto out;
@@ -426,7 +430,7 @@ const struct inode_operations ext2_dir_inode_operations = { .mkdir = ext2_mkdir, .rmdir = ext2_rmdir, .mknod = ext2_mknod, - .rename = ext2_rename, + .rename2 = ext2_rename, #ifdef CONFIG_EXT2_FS_XATTR .setxattr = generic_setxattr, .getxattr = generic_getxattr,
fs/fat/namei_msdos.c +6 -2
@@ -596,12 +596,16 @@ error_inode:/***** Rename, a wrapper for rename_same_dir & rename_diff_dir */ static int msdos_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct super_block *sb = old_dir->i_sb;unsigned char old_msdos_name[MSDOS_NAME ], new_msdos_name[MSDOS_NAME ];int err, is_hid; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +mutex_lock (&MSDOS_SB (sb)->s_lock); err = msdos_format_name(old_dentry->d_name.name,
@@ -633,7 +637,7 @@ static const struct inode_operations msdos_dir_inode_operations = { .unlink = msdos_unlink, .mkdir = msdos_mkdir, .rmdir = msdos_rmdir, - .rename = msdos_rename, + .rename2 = msdos_rename, .setattr = fat_setattr, .getattr = fat_getattr, };
fs/fat/namei_vfat.c +6 -2
@@ -903,7 +903,8 @@ out: }static int vfat_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct buffer_head *dotdot_bh;struct msdos_dir_entry *dotdot_de;
@@ -914,6 +915,9 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,int err, is_dir, update_dotdot, corrupt =0 ;struct super_block *sb = old_dir->i_sb; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_sinfo.bh = sinfo.bh = dotdot_bh =NULL ; old_inode =d_inode (old_dentry); new_inode =d_inode (new_dentry);
@@ -1036,7 +1040,7 @@ static const struct inode_operations vfat_dir_inode_operations = { .unlink = vfat_unlink, .mkdir = vfat_mkdir, .rmdir = vfat_rmdir, - .rename = vfat_rename, + .rename2 = vfat_rename, .setattr = fat_setattr, .getattr = fat_getattr, };
fs/hfs/dir.c +6 -2
@@ -286,10 +286,14 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)* XXX: how do you handle must_be dir? */ static int hfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int res; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* Unlink destination if it already exists */ if (d_really_is_positive (new_dentry)) { res =hfs_remove (new_dir, new_dentry);
@@ -320,6 +324,6 @@ const struct inode_operations hfs_dir_inode_operations = { .unlink = hfs_remove, .mkdir = hfs_mkdir, .rmdir = hfs_remove, - .rename = hfs_rename, + .rename2 = hfs_rename, .setattr = hfs_inode_setattr, };
fs/hfsplus/dir.c +6 -2
@@ -530,10 +530,14 @@ static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) }static int hfsplus_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int res; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* Unlink destination if it already exists */ if (d_really_is_positive (new_dentry)) {if (d_is_dir (new_dentry))
@@ -561,7 +565,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { .rmdir = hfsplus_rmdir, .symlink = hfsplus_symlink, .mknod = hfsplus_mknod, - .rename = hfsplus_rename, + .rename2 = hfsplus_rename, .setxattr = generic_setxattr, .getxattr = generic_getxattr, .listxattr = hfsplus_listxattr,
fs/hpfs/namei.c +6 -2
@@ -507,7 +507,8 @@ const struct address_space_operations hpfs_symlink_aops = { };static int hpfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {const unsigned char *old_name = old_dentry->d_name.name;unsigned old_len = old_dentry->d_name.len;
@@ -524,6 +525,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct fnode *fnode;int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if ((err =hpfs_chk_name (new_name, &new_len)))return err; err =0 ;hpfs_adjust_length (old_name, &old_len);
@@ -618,6 +622,6 @@ const struct inode_operations hpfs_dir_iops = .mkdir = hpfs_mkdir, .rmdir = hpfs_rmdir, .mknod = hpfs_mknod, - .rename = hpfs_rename, + .rename2 = hpfs_rename, .setattr = hpfs_setattr, };
fs/jffs2/dir.c +8 -3
@@ -35,7 +35,8 @@ static int jffs2_mkdir (struct inode *,struct dentry *,umode_t);static int jffs2_rmdir (struct inode *,struct dentry *);static int jffs2_mknod (struct inode *,struct dentry *,umode_t ,dev_t );static int jffs2_rename (struct inode *,struct dentry *, -struct inode *,struct dentry *); +struct inode *,struct dentry *, +unsigned int );const struct file_operations jffs2_dir_operations = {
@@ -57,7 +58,7 @@ const struct inode_operations jffs2_dir_inode_operations = .mkdir = jffs2_mkdir, .rmdir = jffs2_rmdir, .mknod = jffs2_mknod, - .rename = jffs2_rename, + .rename2 = jffs2_rename, .get_acl = jffs2_get_acl, .set_acl = jffs2_set_acl, .setattr = jffs2_setattr,
@@ -759,7 +760,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode }static int jffs2_rename (struct inode *old_dir_i,struct dentry *old_dentry, -struct inode *new_dir_i,struct dentry *new_dentry) +struct inode *new_dir_i,struct dentry *new_dentry, +unsigned int flags) {int ret;struct jffs2_sb_info *c =JFFS2_SB_INFO (old_dir_i->i_sb);
@@ -767,6 +769,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,uint8_t type;uint32_t now; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* The VFS will check for us and prevent trying to rename a * file over a directory and vice versa, but if it's a directory, * the VFS can't check whether the victim is empty. The filesystem
fs/jfs/namei.c +5 -2
@@ -1078,7 +1078,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,* FUNCTION: rename a file or directory */ static int jfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct btstack btstack;ino_t ino;
@@ -1097,6 +1098,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,s64 new_size =0 ;int commit_flag; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ;jfs_info ("jfs_rename: %pd %pd" , old_dentry, new_dentry);
@@ -1536,7 +1539,7 @@ const struct inode_operations jfs_dir_inode_operations = { .mkdir = jfs_mkdir, .rmdir = jfs_rmdir, .mknod = jfs_mknod, - .rename = jfs_rename, + .rename2 = jfs_rename, .setxattr = generic_setxattr, .getxattr = generic_getxattr, .listxattr = jfs_listxattr,
fs/logfs/dir.c +6 -2
@@ -718,8 +718,12 @@ out: }static int logfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) { +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if (d_really_is_positive (new_dentry))return logfs_rename_target (old_dir, old_dentry, new_dir, new_dentry);
@@ -783,7 +787,7 @@ const struct inode_operations logfs_dir_iops = { .lookup = logfs_lookup, .mkdir = logfs_mkdir, .mknod = logfs_mknod, - .rename = logfs_rename, + .rename2 = logfs_rename, .rmdir = logfs_rmdir, .symlink = logfs_symlink, .unlink = logfs_unlink,
fs/minix/namei.c +6 -2
@@ -185,7 +185,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry) }static int minix_rename (struct inode * old_dir,struct dentry *old_dentry, -struct inode * new_dir,struct dentry *new_dentry) +struct inode * new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode * old_inode =d_inode (old_dentry);struct inode * new_inode =d_inode (new_dentry);
@@ -195,6 +196,9 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,struct minix_dir_entry * old_de;int err = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_de =minix_find_entry (old_dentry, &old_page);if (!old_de) goto out;
@@ -264,7 +268,7 @@ const struct inode_operations minix_dir_inode_operations = { .mkdir = minix_mkdir, .rmdir = minix_rmdir, .mknod = minix_mknod, - .rename = minix_rename, + .rename2 = minix_rename, .getattr = minix_getattr, .tmpfile = minix_tmpfile, };
fs/nilfs2/namei.c +6 -2
@@ -350,7 +350,8 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) }static int nilfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);
@@ -361,6 +362,9 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct nilfs_transaction_info ti;int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + err =nilfs_transaction_begin (old_dir->i_sb, &ti,1 );if (unlikely (err))return err;
@@ -552,7 +556,7 @@ const struct inode_operations nilfs_dir_inode_operations = { .mkdir = nilfs_mkdir, .rmdir = nilfs_rmdir, .mknod = nilfs_mknod, - .rename = nilfs_rename, + .rename2 = nilfs_rename, .setattr = nilfs_setattr, .permission = nilfs_permission, .fiemap = nilfs_fiemap,
fs/omfs/dir.c +6 -2
@@ -371,12 +371,16 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx, }static int omfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *new_inode =d_inode (new_dentry);struct inode *old_inode =d_inode (old_dentry);int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if (new_inode) {/* overwriting existing file/dir */ err =omfs_remove (new_dir, new_dentry);
@@ -444,7 +448,7 @@ static int omfs_readdir(struct file *file, struct dir_context *ctx)const struct inode_operations omfs_dir_inops = { .lookup = omfs_lookup, .mkdir = omfs_mkdir, - .rename = omfs_rename, + .rename2 = omfs_rename, .create = omfs_create, .unlink = omfs_remove, .rmdir = omfs_remove,
fs/reiserfs/namei.c +6 -2
@@ -1306,7 +1306,8 @@ static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de,* get_empty_nodes or its clones */ static int reiserfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int retval;INITIALIZE_PATH (old_entry_path);
@@ -1321,6 +1322,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,unsigned long savelink =1 ;struct timespec ctime; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* * three balancings: (1) old name removal, (2) new name insertion * and (3) maybe "save" link insertion
@@ -1648,7 +1652,7 @@ const struct inode_operations reiserfs_dir_inode_operations = { .mkdir = reiserfs_mkdir, .rmdir = reiserfs_rmdir, .mknod = reiserfs_mknod, - .rename = reiserfs_rename, + .rename2 = reiserfs_rename, .setattr = reiserfs_setattr, .setxattr = generic_setxattr, .getxattr = generic_getxattr,
fs/sysv/namei.c +6 -2
@@ -206,7 +206,8 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry)* higher-level routines. */ static int sysv_rename (struct inode * old_dir,struct dentry * old_dentry, -struct inode * new_dir,struct dentry * new_dentry) +struct inode * new_dir,struct dentry * new_dentry, +unsigned int flags) {struct inode * old_inode =d_inode (old_dentry);struct inode * new_inode =d_inode (new_dentry);
@@ -216,6 +217,9 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,struct sysv_dir_entry * old_de;int err = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_de =sysv_find_entry (old_dentry, &old_page);if (!old_de) goto out;
@@ -285,6 +289,6 @@ const struct inode_operations sysv_dir_inode_operations = { .mkdir = sysv_mkdir, .rmdir = sysv_rmdir, .mknod = sysv_mknod, - .rename = sysv_rename, + .rename2 = sysv_rename, .getattr = sysv_getattr, };
fs/ubifs/dir.c +6 -2
@@ -966,7 +966,8 @@ static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, }static int ubifs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct ubifs_info *c = old_dir->i_sb->s_fs_info;struct inode *old_inode =d_inode (old_dentry);
@@ -984,6 +985,9 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,struct timespec time;unsigned int uninitialized_var (saved_nlink ); +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* * Budget request settings: deletion direntry, new direntry, removing * the old inode, and changing old and new parent directory inodes.
@@ -1179,7 +1183,7 @@ const struct inode_operations ubifs_dir_inode_operations = { .mkdir = ubifs_mkdir, .rmdir = ubifs_rmdir, .mknod = ubifs_mknod, - .rename = ubifs_rename, + .rename2 = ubifs_rename, .setattr = ubifs_setattr, .getattr = ubifs_getattr, .setxattr = generic_setxattr,
fs/udf/namei.c +6 -2
@@ -1093,7 +1093,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,* higher-level routines. */ static int udf_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);
@@ -1105,6 +1106,9 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,struct kernel_lb_addr tloc;struct udf_inode_info *old_iinfo =UDF_I (old_inode); +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + ofi =udf_find_entry (old_dir, &old_dentry->d_name, &ofibh, &ocfi);if (IS_ERR (ofi)) { retval =PTR_ERR (ofi);
@@ -1353,6 +1357,6 @@ const struct inode_operations udf_dir_inode_operations = { .mkdir = udf_mkdir, .rmdir = udf_rmdir, .mknod = udf_mknod, - .rename = udf_rename, + .rename2 = udf_rename, .tmpfile = udf_tmpfile, };
fs/ufs/namei.c +6 -2
@@ -245,7 +245,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry) }static int ufs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);
@@ -255,6 +256,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,struct ufs_dir_entry *old_de;int err = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_de =ufs_find_entry (old_dir, &old_dentry->d_name, &old_page);if (!old_de) goto out;
@@ -333,5 +337,5 @@ const struct inode_operations ufs_dir_inode_operations = { .mkdir = ufs_mkdir, .rmdir = ufs_rmdir, .mknod = ufs_mknod, - .rename = ufs_rename, + .rename2 = ufs_rename, };
Signature · 1 line
2.5.5
Re: [PATCH 2/7] fs: support RENAME_NOREPLACE for local filesystems
Miklos,
Quoted 25 lines · Miklos Szeredi
fs/ubifs/dir.c +5
-1@@ -966,7 +966,8 @@ static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, }static int ubifs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct ubifs_info *c = old_dir->i_sb->s_fs_info;struct inode *old_inode =d_inode (old_dentry);@@ -984,6 +985,9 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,struct timespec time;unsigned int uninitialized_var (saved_nlink ); +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* * Budget request settings: deletion direntry, new direntry, removing * the old inode, and changing old and new parent directory inodes.
fs/ubifs/dir.c const struct inode_operations ubifs_dir_inode_operations = { · line 1189
Quoted 8 lines
fs/ubifs/dir.c +1
-1@@ -1179,7 +1183,7 @@ const struct inode_operations ubifs_dir_inode_operations = { .mkdir = ubifs_mkdir, .rmdir = ubifs_rmdir, .mknod = ubifs_mknod, - .rename = ubifs_rename, + .rename2 = ubifs_rename, .setattr = ubifs_setattr, .getattr = ubifs_getattr, .setxattr = generic_setxattr,
For UBIFS,
Thanks,,
//richard
Re: [PATCH 2/7] fs: support RENAME_NOREPLACE for local filesystems
In reply to Miklos SzerediOn Tue, Aug 23, 2016 at 04:05:27PM +0200, Miklos Szeredi wrote:omfs/dir.c b/fs/omfs/dir.c
fs/omfs/dir.c static int omfs_readdir(struct file *file, struct dir_context *ctx)
Quoted 22 lines
index
c8cbf3b60645..417511bbe362100644fs/omfs/dir.c +5
-1@@ -371,12 +371,16 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx, }static int omfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *new_inode =d_inode (new_dentry);struct inode *old_inode =d_inode (old_dentry);int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if (new_inode) {/* overwriting existing file/dir */ err =omfs_remove (new_dir, new_dentry);@@ -444,7 +448,7 @@ static int omfs_readdir(struct file *file, struct dir_context *ctx)
omfs changes look fine.
Signature · 1 line
Bob Copeland %% http://bobcopeland.com/
Re: [PATCH 2/7] fs: support RENAME_NOREPLACE for local filesystems
In reply to Miklos SzerediQuoted 10 lines · Miklos Szeredi
This is trivial to do:
- add flags argument to
foo_rename()
- check if flags doesn't have any other thanRENAME_NOREPLACE
- assignfoo_rename()to .rename2 instead of .renameFilesystems converted:
affs, bfs, ext2, hfs, hfsplus, jffs2, jfs, logfs, minix, msdos, nilfs2, omfs, reiserfs, sysvfs, ubifs, udf, ufs, vfat.
ext2, UDF, and reiserfs changes look fine. You can add:
Honza
Quoted 668 lines
Signed-off-by Miklos Szeredi <[email protected]>Cc Jan Kara <[email protected]>Cc Theodore Ts'o <[email protected]>Cc Jaegeuk Kim <[email protected]>Cc OGAWA Hirofumi <[email protected]>Cc Mikulas Patocka <[email protected]>Cc David Woodhouse <[email protected]>Cc Dave Kleikamp <[email protected]>Cc Ryusuke Konishi <[email protected]>Cc Bob Copeland <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Richard Weinberger <[email protected]>--- fs/affs/affs.h | 3 ++- fs/affs/dir.c | 2 +- fs/affs/namei.c | 6 +++++- fs/bfs/dir.c | 8 ++++++-- fs/ext2/namei.c | 8 ++++++-- fs/fat/namei_msdos.c | 8 ++++++-- fs/fat/namei_vfat.c | 8 ++++++-- fs/hfs/dir.c | 8 ++++++-- fs/hfsplus/dir.c | 8 ++++++-- fs/hpfs/namei.c | 8 ++++++-- fs/jffs2/dir.c | 11 ++++++++--- fs/jfs/namei.c | 7 +++++-- fs/logfs/dir.c | 8 ++++++-- fs/minix/namei.c | 8 ++++++-- fs/nilfs2/namei.c | 8 ++++++-- fs/omfs/dir.c | 8 ++++++-- fs/reiserfs/namei.c | 8 ++++++-- fs/sysv/namei.c | 8 ++++++-- fs/ubifs/dir.c | 8 ++++++-- fs/udf/namei.c | 8 ++++++-- fs/ufs/namei.c | 8 ++++++-- 21 files changed, 117 insertions(+), 40 deletions(-)fs/affs/affs.h +2
-1@@ -173,7 +173,8 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,extern int affs_symlink (struct inode *dir,struct dentry *dentry,const char *symname);extern int affs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry); +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags);/* inode.c */ fs/affs/dir.c +1
-1@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = { .symlink = affs_symlink, .mkdir = affs_mkdir, .rmdir = affs_rmdir, - .rename = affs_rename, + .rename2 = affs_rename, .setattr = affs_notify_change, };fs/affs/namei.c +5
-1@@ -414,12 +414,16 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)int affs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct super_block *sb = old_dir->i_sb;struct buffer_head *bh =NULL ;int retval; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +pr_debug ("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n" , __func__, old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);fs/bfs/dir.c +6
-2@@ -207,7 +207,8 @@ out_brelse: }static int bfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode, *new_inode;struct buffer_head *old_bh, *new_bh;@@ -215,6 +216,9 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct bfs_sb_info *info;int error = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_bh = new_bh =NULL ; old_inode =d_inode (old_dentry);if (S_ISDIR (old_inode->i_mode))@@ -270,7 +274,7 @@ const struct inode_operations bfs_dir_inops = { .lookup = bfs_lookup, .link = bfs_link, .unlink = bfs_unlink, - .rename = bfs_rename, + .rename2 = bfs_rename, }; static int bfs_add_entry(struct inode *dir, const unsigned char *name,fs/ext2/namei.c +6
-2@@ -328,7 +328,8 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry) }static int ext2_rename (struct inode * old_dir,struct dentry * old_dentry, -struct inode * new_dir,struct dentry * new_dentry ) +struct inode * new_dir,struct dentry * new_dentry, +unsigned int flags) {struct inode * old_inode =d_inode (old_dentry);struct inode * new_inode =d_inode (new_dentry);@@ -338,6 +339,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,struct ext2_dir_entry_2 * old_de;int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + err =dquot_initialize (old_dir);if (err) goto out;@@ -426,7 +430,7 @@ const struct inode_operations ext2_dir_inode_operations = { .mkdir = ext2_mkdir, .rmdir = ext2_rmdir, .mknod = ext2_mknod, - .rename = ext2_rename, + .rename2 = ext2_rename, #ifdef CONFIG_EXT2_FS_XATTR .setxattr = generic_setxattr, .getxattr = generic_getxattr,fs/fat/namei_msdos.c +6
-2@@ -596,12 +596,16 @@ error_inode:/***** Rename, a wrapper for rename_same_dir & rename_diff_dir */ static int msdos_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct super_block *sb = old_dir->i_sb;unsigned char old_msdos_name[MSDOS_NAME ], new_msdos_name[MSDOS_NAME ];int err, is_hid; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +mutex_lock (&MSDOS_SB (sb)->s_lock); err = msdos_format_name(old_dentry->d_name.name,@@ -633,7 +637,7 @@ static const struct inode_operations msdos_dir_inode_operations = { .unlink = msdos_unlink, .mkdir = msdos_mkdir, .rmdir = msdos_rmdir, - .rename = msdos_rename, + .rename2 = msdos_rename, .setattr = fat_setattr, .getattr = fat_getattr, };fs/fat/namei_vfat.c +6
-2@@ -903,7 +903,8 @@ out: }static int vfat_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct buffer_head *dotdot_bh;struct msdos_dir_entry *dotdot_de;@@ -914,6 +915,9 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,int err, is_dir, update_dotdot, corrupt =0 ;struct super_block *sb = old_dir->i_sb; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_sinfo.bh = sinfo.bh = dotdot_bh =NULL ; old_inode =d_inode (old_dentry); new_inode =d_inode (new_dentry);@@ -1036,7 +1040,7 @@ static const struct inode_operations vfat_dir_inode_operations = { .unlink = vfat_unlink, .mkdir = vfat_mkdir, .rmdir = vfat_rmdir, - .rename = vfat_rename, + .rename2 = vfat_rename, .setattr = fat_setattr, .getattr = fat_getattr, };fs/hfs/dir.c +6
-2@@ -286,10 +286,14 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)* XXX: how do you handle must_be dir? */ static int hfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int res; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* Unlink destination if it already exists */ if (d_really_is_positive (new_dentry)) { res =hfs_remove (new_dir, new_dentry);@@ -320,6 +324,6 @@ const struct inode_operations hfs_dir_inode_operations = { .unlink = hfs_remove, .mkdir = hfs_mkdir, .rmdir = hfs_remove, - .rename = hfs_rename, + .rename2 = hfs_rename, .setattr = hfs_inode_setattr, };fs/hfsplus/dir.c +6
-2@@ -530,10 +530,14 @@ static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) }static int hfsplus_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int res; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* Unlink destination if it already exists */ if (d_really_is_positive (new_dentry)) {if (d_is_dir (new_dentry))@@ -561,7 +565,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { .rmdir = hfsplus_rmdir, .symlink = hfsplus_symlink, .mknod = hfsplus_mknod, - .rename = hfsplus_rename, + .rename2 = hfsplus_rename, .setxattr = generic_setxattr, .getxattr = generic_getxattr, .listxattr = hfsplus_listxattr,fs/hpfs/namei.c +6
-2@@ -507,7 +507,8 @@ const struct address_space_operations hpfs_symlink_aops = { };static int hpfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {const unsigned char *old_name = old_dentry->d_name.name;unsigned old_len = old_dentry->d_name.len;@@ -524,6 +525,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct fnode *fnode;int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if ((err =hpfs_chk_name (new_name, &new_len)))return err; err =0 ;hpfs_adjust_length (old_name, &old_len);@@ -618,6 +622,6 @@ const struct inode_operations hpfs_dir_iops = .mkdir = hpfs_mkdir, .rmdir = hpfs_rmdir, .mknod = hpfs_mknod, - .rename = hpfs_rename, + .rename2 = hpfs_rename, .setattr = hpfs_setattr, };fs/jffs2/dir.c +8
-3@@ -35,7 +35,8 @@ static int jffs2_mkdir (struct inode *,struct dentry *,umode_t);static int jffs2_rmdir (struct inode *,struct dentry *);static int jffs2_mknod (struct inode *,struct dentry *,umode_t ,dev_t );static int jffs2_rename (struct inode *,struct dentry *, -struct inode *,struct dentry *); +struct inode *,struct dentry *, +unsigned int );const struct file_operations jffs2_dir_operations = {@@ -57,7 +58,7 @@ const struct inode_operations jffs2_dir_inode_operations = .mkdir = jffs2_mkdir, .rmdir = jffs2_rmdir, .mknod = jffs2_mknod, - .rename = jffs2_rename, + .rename2 = jffs2_rename, .get_acl = jffs2_get_acl, .set_acl = jffs2_set_acl, .setattr = jffs2_setattr,@@ -759,7 +760,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode }static int jffs2_rename (struct inode *old_dir_i,struct dentry *old_dentry, -struct inode *new_dir_i,struct dentry *new_dentry) +struct inode *new_dir_i,struct dentry *new_dentry, +unsigned int flags) {int ret;struct jffs2_sb_info *c =JFFS2_SB_INFO (old_dir_i->i_sb);@@ -767,6 +769,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,uint8_t type;uint32_t now; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* The VFS will check for us and prevent trying to rename a * file over a directory and vice versa, but if it's a directory, * the VFS can't check whether the victim is empty. The filesystem fs/jfs/namei.c +5
-2@@ -1078,7 +1078,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,* FUNCTION: rename a file or directory */ static int jfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct btstack btstack;ino_t ino;@@ -1097,6 +1098,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,s64 new_size =0 ;int commit_flag; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ;jfs_info ("jfs_rename: %pd %pd" , old_dentry, new_dentry);@@ -1536,7 +1539,7 @@ const struct inode_operations jfs_dir_inode_operations = { .mkdir = jfs_mkdir, .rmdir = jfs_rmdir, .mknod = jfs_mknod, - .rename = jfs_rename, + .rename2 = jfs_rename, .setxattr = generic_setxattr, .getxattr = generic_getxattr, .listxattr = jfs_listxattr,fs/logfs/dir.c +6
-2@@ -718,8 +718,12 @@ out: }static int logfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) { +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if (d_really_is_positive (new_dentry))return logfs_rename_target (old_dir, old_dentry, new_dir, new_dentry);@@ -783,7 +787,7 @@ const struct inode_operations logfs_dir_iops = { .lookup = logfs_lookup, .mkdir = logfs_mkdir, .mknod = logfs_mknod, - .rename = logfs_rename, + .rename2 = logfs_rename, .rmdir = logfs_rmdir, .symlink = logfs_symlink, .unlink = logfs_unlink,fs/minix/namei.c +6
-2@@ -185,7 +185,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry) }static int minix_rename (struct inode * old_dir,struct dentry *old_dentry, -struct inode * new_dir,struct dentry *new_dentry) +struct inode * new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode * old_inode =d_inode (old_dentry);struct inode * new_inode =d_inode (new_dentry);@@ -195,6 +196,9 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,struct minix_dir_entry * old_de;int err = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_de =minix_find_entry (old_dentry, &old_page);if (!old_de) goto out;@@ -264,7 +268,7 @@ const struct inode_operations minix_dir_inode_operations = { .mkdir = minix_mkdir, .rmdir = minix_rmdir, .mknod = minix_mknod, - .rename = minix_rename, + .rename2 = minix_rename, .getattr = minix_getattr, .tmpfile = minix_tmpfile, };fs/nilfs2/namei.c +6
-2@@ -350,7 +350,8 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) }static int nilfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);@@ -361,6 +362,9 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct nilfs_transaction_info ti;int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + err =nilfs_transaction_begin (old_dir->i_sb, &ti,1 );if (unlikely (err))return err;@@ -552,7 +556,7 @@ const struct inode_operations nilfs_dir_inode_operations = { .mkdir = nilfs_mkdir, .rmdir = nilfs_rmdir, .mknod = nilfs_mknod, - .rename = nilfs_rename, + .rename2 = nilfs_rename, .setattr = nilfs_setattr, .permission = nilfs_permission, .fiemap = nilfs_fiemap,fs/omfs/dir.c +6
-2@@ -371,12 +371,16 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx, }static int omfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *new_inode =d_inode (new_dentry);struct inode *old_inode =d_inode (old_dentry);int err; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if (new_inode) {/* overwriting existing file/dir */ err =omfs_remove (new_dir, new_dentry);@@ -444,7 +448,7 @@ static int omfs_readdir(struct file *file, struct dir_context *ctx)const struct inode_operations omfs_dir_inops = { .lookup = omfs_lookup, .mkdir = omfs_mkdir, - .rename = omfs_rename, + .rename2 = omfs_rename, .create = omfs_create, .unlink = omfs_remove, .rmdir = omfs_remove,fs/reiserfs/namei.c +6
-2@@ -1306,7 +1306,8 @@ static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de,* get_empty_nodes or its clones */ static int reiserfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int retval;INITIALIZE_PATH (old_entry_path);@@ -1321,6 +1322,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,unsigned long savelink =1 ;struct timespec ctime; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* * three balancings: (1) old name removal, (2) new name insertion * and (3) maybe "save" link insertion @@ -1648,7 +1652,7 @@ const struct inode_operations reiserfs_dir_inode_operations = { .mkdir = reiserfs_mkdir, .rmdir = reiserfs_rmdir, .mknod = reiserfs_mknod, - .rename = reiserfs_rename, + .rename2 = reiserfs_rename, .setattr = reiserfs_setattr, .setxattr = generic_setxattr, .getxattr = generic_getxattr,fs/sysv/namei.c +6
-2@@ -206,7 +206,8 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry)* higher-level routines. */ static int sysv_rename (struct inode * old_dir,struct dentry * old_dentry, -struct inode * new_dir,struct dentry * new_dentry) +struct inode * new_dir,struct dentry * new_dentry, +unsigned int flags) {struct inode * old_inode =d_inode (old_dentry);struct inode * new_inode =d_inode (new_dentry);@@ -216,6 +217,9 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,struct sysv_dir_entry * old_de;int err = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_de =sysv_find_entry (old_dentry, &old_page);if (!old_de) goto out;@@ -285,6 +289,6 @@ const struct inode_operations sysv_dir_inode_operations = { .mkdir = sysv_mkdir, .rmdir = sysv_rmdir, .mknod = sysv_mknod, - .rename = sysv_rename, + .rename2 = sysv_rename, .getattr = sysv_getattr, };fs/ubifs/dir.c +6
-2@@ -966,7 +966,8 @@ static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, }static int ubifs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct ubifs_info *c = old_dir->i_sb->s_fs_info;struct inode *old_inode =d_inode (old_dentry);@@ -984,6 +985,9 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,struct timespec time;unsigned int uninitialized_var (saved_nlink ); +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +/* * Budget request settings: deletion direntry, new direntry, removing * the old inode, and changing old and new parent directory inodes. @@ -1179,7 +1183,7 @@ const struct inode_operations ubifs_dir_inode_operations = { .mkdir = ubifs_mkdir, .rmdir = ubifs_rmdir, .mknod = ubifs_mknod, - .rename = ubifs_rename, + .rename2 = ubifs_rename, .setattr = ubifs_setattr, .getattr = ubifs_getattr, .setxattr = generic_setxattr,fs/udf/namei.c +6
-2@@ -1093,7 +1093,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,* higher-level routines. */ static int udf_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);@@ -1105,6 +1106,9 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,struct kernel_lb_addr tloc;struct udf_inode_info *old_iinfo =UDF_I (old_inode); +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + ofi =udf_find_entry (old_dir, &old_dentry->d_name, &ofibh, &ocfi);if (IS_ERR (ofi)) { retval =PTR_ERR (ofi);@@ -1353,6 +1357,6 @@ const struct inode_operations udf_dir_inode_operations = { .mkdir = udf_mkdir, .rmdir = udf_rmdir, .mknod = udf_mknod, - .rename = udf_rename, + .rename2 = udf_rename, .tmpfile = udf_tmpfile, };fs/ufs/namei.c +6
-2@@ -245,7 +245,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry) }static int ufs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);@@ -255,6 +256,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,struct ufs_dir_entry *old_de;int err = -ENOENT ; +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; + old_de =ufs_find_entry (old_dir, &old_dentry->d_name, &old_page);if (!old_de) goto out;@@ -333,5 +337,5 @@ const struct inode_operations ufs_dir_inode_operations = { .mkdir = ufs_mkdir, .rmdir = ufs_rmdir, .mknod = ufs_mknod, - .rename = ufs_rename, + .rename2 = ufs_rename, };Signature · 1 line
2.5.5
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH 3/7 libfs: support RENAME_NOREPLACE in simple_rename()
In reply to Miklos SzerediThis is trivial to do:
- add flags argument to simple_rename()
- check if flags doesn't have any other than RENAME_NOREPLACE
- assign simple_rename() to .rename2 instead of .rename
Filesystems converted:
hugetlbfs, ramfs, bpf.
Debugfs uses simple_rename() to implement debugfs_rename(), which is for debugfs instances to rename files internally, not for userspace filesystem access. For this case pass zero flags to simple_rename().
--- fs/debugfs/inode.c | 2 +- fs/hugetlbfs/inode.c | 2 +- fs/libfs.c | 6 +++++- fs/ramfs/inode.c | 2 +- include/linux/fs.h | 3 ++- kernel/bpf/inode.c | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-)
fs/debugfs/inode.c +1 -1
@@ -748,7 +748,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, old_name =fsnotify_oldname_init (old_dentry->d_name.name); error =simple_rename (d_inode (old_dir), old_dentry,d_inode (new_dir), - dentry); + dentry,0 );if (error) {fsnotify_oldname_free (old_name); goto exit;
fs/hugetlbfs/inode.c +1 -1
@@ -988,7 +988,7 @@ static const struct inode_operations hugetlbfs_dir_inode_operations = { .mkdir = hugetlbfs_mkdir, .rmdir = simple_rmdir, .mknod = hugetlbfs_mknod, - .rename = simple_rename, + .rename2 = simple_rename, .setattr = hugetlbfs_setattr, };
fs/libfs.c +5 -1
@@ -349,11 +349,15 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)EXPORT_SYMBOL (simple_rmdir);int simple_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *inode =d_inode (old_dentry);int they_are_dirs =d_is_dir (old_dentry); +if (flags & ~RENAME_NOREPLACE ) +return -EINVAL ; +if (!simple_empty (new_dentry))return -ENOTEMPTY ;
fs/ramfs/inode.c +1 -1
@@ -146,7 +146,7 @@ static const struct inode_operations ramfs_dir_inode_operations = { .mkdir = ramfs_mkdir, .rmdir = simple_rmdir, .mknod = ramfs_mknod, - .rename = simple_rename, + .rename2 = simple_rename, };static const struct super_operations ramfs_ops = {
include/linux/fs.h +2 -1
@@ -2949,7 +2949,8 @@ extern int simple_open(struct inode *inode, struct file *file);extern int simple_link (struct dentry *,struct inode *,struct dentry *);extern int simple_unlink (struct inode *,struct dentry *);extern int simple_rmdir (struct inode *,struct dentry *); -extern int simple_rename (struct inode *,struct dentry *,struct inode *,struct dentry *); +extern int simple_rename (struct inode *,struct dentry *, +struct inode *,struct dentry *,unsigned int );extern int noop_fsync (struct file *,loff_t ,loff_t ,int );extern int simple_empty (struct dentry *);extern int simple_readpage (struct file *file,struct page *page);
kernel/bpf/inode.c +1 -1
@@ -189,7 +189,7 @@ static const struct inode_operations bpf_dir_iops = { .mknod = bpf_mkobj, .mkdir = bpf_mkdir, .rmdir = simple_rmdir, - .rename = simple_rename, + .rename2 = simple_rename, .link = simple_link, .unlink = simple_unlink, };
Signature · 1 line
2.5.5
Re: [PATCH 3/7] libfs: support RENAME_NOREPLACE in simple_rename()
Quoted 10 lines · Miklos Szeredi
This is trivial to do:
- add flags argument to
simple_rename()
- check if flags doesn't have any other thanRENAME_NOREPLACE
- assignsimple_rename()to .rename2 instead of .renameFilesystems converted:
hugetlbfs, ramfs, bpf.
Quoted 7 lines
Debugfs uses
simple_rename()to implementdebugfs_rename(), which is for debugfs instances to rename files internally, not for userspace filesystem access. For this case pass zero flags tosimple_rename().Signed-off-by Miklos Szeredi <[email protected]>Cc Alexei Starovoitov <[email protected]>Cc Greg Kroah-Hartman <[email protected]>
PATCH 4/7 fs: make remaining filesystems use .rename2
In reply to Miklos SzerediThis is trivial to do:
- add flags argument to foo_rename()
- check if flags is zero
- assign foo_rename() to .rename2 instead of .rename
This doesn't mean it's impossible to support RENAME_NOREPLACE for these filesystems, but it is not trivial, like for local filesystems. RENAME_NOREPLACE must guarantee atomicity (i.e. it shouldn't be possible for a file to be created on one host while it is overwritten by rename on another host).
Filesystems converted:
9p, afs, ceph, coda, ecryptfs, exofs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs.
After this, we can get rid of the duplicate interfaces for rename.
--- drivers/staging/lustre/lustre/llite/namei.c | 8 ++++++-- fs/9p/v9fs.h | 3 ++- fs/9p/vfs_inode.c | 10 +++++++--- fs/9p/vfs_inode_dotl.c | 2 +- fs/afs/dir.c | 11 ++++++++--- fs/ceph/dir.c | 10 +++++++--- fs/coda/dir.c | 8 ++++++-- fs/ecryptfs/inode.c | 8 ++++++-- fs/exofs/namei.c | 8 ++++++-- fs/kernfs/dir.c | 8 ++++++-- fs/ncpfs/dir.c | 10 +++++++--- fs/nfs/dir.c | 6 +++++- fs/nfs/internal.h | 3 ++- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 2 +- fs/nfs/proc.c | 2 +- fs/ocfs2/namei.c | 8 ++++++-- fs/orangefs/namei.c | 8 ++++++-- 18 files changed, 84 insertions(+), 33 deletions(-)
drivers/staging/lustre/lustre/llite/namei.c +6 -2
@@ -1045,13 +1045,17 @@ out: }static int ll_rename (struct inode *src,struct dentry *src_dchild, -struct inode *tgt,struct dentry *tgt_dchild) +struct inode *tgt,struct dentry *tgt_dchild, +unsigned int flags) {struct ptlrpc_request *request =NULL ;struct ll_sb_info *sbi =ll_i2sbi (src);struct md_op_data *op_data;int err; +if (flags) +return -EINVAL ; + CDEBUG(D_VFSTRACE, "VFS Op:oldname=%pd, src_dir="DFID"(%p), newname=%pd, tgt_dir="DFID"(%p)\n", src_dchild, PFID(ll_inode2fid(src)), src,
@@ -1097,7 +1101,7 @@ const struct inode_operations ll_dir_inode_operations = { .rmdir = ll_rmdir, .symlink = ll_symlink, .link = ll_link, - .rename = ll_rename, + .rename2 = ll_rename, .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission,
fs/9p/v9fs.h +2 -1
@@ -148,7 +148,8 @@ extern struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,extern int v9fs_vfs_unlink (struct inode *i,struct dentry *d);extern int v9fs_vfs_rmdir (struct inode *i,struct dentry *d);extern int v9fs_vfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry); +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags);extern struct inode *v9fs_inode_from_fid (struct v9fs_session_info *v9ses,struct p9_fid *fid,struct super_block *sb,int new);
fs/9p/vfs_inode.c +7 -3
@@ -955,7 +955,8 @@ int v9fs_vfs_rmdir(struct inode *i, struct dentry *d)int v9fs_vfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int retval;struct inode *old_inode;
@@ -966,6 +967,9 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct p9_fid *newdirfid;struct p9_wstat wstat; +if (flags) +return -EINVAL ; +p9_debug (P9_DEBUG_VFS ,"\n" ); retval =0 ; old_inode =d_inode (old_dentry);
@@ -1436,7 +1440,7 @@ static const struct inode_operations v9fs_dir_inode_operations_dotu = { .mkdir = v9fs_vfs_mkdir, .rmdir = v9fs_vfs_rmdir, .mknod = v9fs_vfs_mknod, - .rename = v9fs_vfs_rename, + .rename2 = v9fs_vfs_rename, .getattr = v9fs_vfs_getattr, .setattr = v9fs_vfs_setattr, };
@@ -1449,7 +1453,7 @@ static const struct inode_operations v9fs_dir_inode_operations = { .mkdir = v9fs_vfs_mkdir, .rmdir = v9fs_vfs_rmdir, .mknod = v9fs_vfs_mknod, - .rename = v9fs_vfs_rename, + .rename2 = v9fs_vfs_rename, .getattr = v9fs_vfs_getattr, .setattr = v9fs_vfs_setattr, };
fs/9p/vfs_inode_dotl.c +1 -1
@@ -964,7 +964,7 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = { .mkdir = v9fs_vfs_mkdir_dotl, .rmdir = v9fs_vfs_rmdir, .mknod = v9fs_vfs_mknod_dotl, - .rename = v9fs_vfs_rename, + .rename2 = v9fs_vfs_rename, .getattr = v9fs_vfs_getattr_dotl, .setattr = v9fs_vfs_setattr_dotl, .setxattr = generic_setxattr,
fs/afs/dir.c +8 -3
@@ -38,7 +38,8 @@ static int afs_link(struct dentry *from, struct inode *dir,static int afs_symlink (struct inode *dir,struct dentry *dentry,const char *content);static int afs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry); +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags);const struct file_operations afs_dir_file_operations = { .open = afs_dir_open,
@@ -56,7 +57,7 @@ const struct inode_operations afs_dir_inode_operations = { .symlink = afs_symlink, .mkdir = afs_mkdir, .rmdir = afs_rmdir, - .rename = afs_rename, + .rename2 = afs_rename, .permission = afs_permission, .getattr = afs_getattr, .setattr = afs_setattr,
@@ -1083,12 +1084,16 @@ error:* rename a file in an AFS filesystem and/or move it between directories */ static int afs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct afs_vnode *orig_dvnode, *new_dvnode, *vnode;struct key *key;int ret; +if (flags) +return -EINVAL ; + vnode =AFS_FS_I (d_inode (old_dentry)); orig_dvnode =AFS_FS_I (old_dir); new_dvnode =AFS_FS_I (new_dir);
fs/ceph/dir.c +7 -3
@@ -1061,7 +1061,8 @@ out: }static int ceph_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct ceph_fs_client *fsc =ceph_sb_to_client (old_dir->i_sb);struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -1069,6 +1070,9 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,int op =CEPH_MDS_OP_RENAME ;int err; +if (flags) +return -EINVAL ; +if (ceph_snap (old_dir) !=ceph_snap (new_dir))return -EXDEV ;if (ceph_snap (old_dir) !=CEPH_NOSNAP ) {
@@ -1498,7 +1502,7 @@ const struct inode_operations ceph_dir_iops = { .link = ceph_link, .unlink = ceph_unlink, .rmdir = ceph_unlink, - .rename = ceph_rename, + .rename2 = ceph_rename, .create = ceph_create, .atomic_open = ceph_atomic_open, };
@@ -1509,7 +1513,7 @@ const struct inode_operations ceph_snapdir_iops = { .getattr = ceph_getattr, .mkdir = ceph_mkdir, .rmdir = ceph_unlink, - .rename = ceph_rename, + .rename2 = ceph_rename, };const struct dentry_operations ceph_dentry_ops = {
fs/coda/dir.c +6 -2
@@ -291,7 +291,8 @@ static int coda_rmdir(struct inode *dir, struct dentry *de)/* rename */ static int coda_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {const char *old_name = old_dentry->d_name.name;const char *new_name = new_dentry->d_name.name;
@@ -299,6 +300,9 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,int new_length = new_dentry->d_name.len;int error; +if (flags) +return -EINVAL ; + error =venus_rename (old_dir->i_sb,coda_i2f (old_dir),coda_i2f (new_dir), old_length, new_length, (const char *) old_name, (const char *)new_name);
@@ -569,7 +573,7 @@ const struct inode_operations coda_dir_inode_operations = { .mkdir = coda_mkdir, .rmdir = coda_rmdir, .mknod = CODA_EIO_ERROR, - .rename = coda_rename, + .rename2 = coda_rename, .permission = coda_permission, .getattr = coda_getattr, .setattr = coda_setattr,
fs/ecryptfs/inode.c +6 -2
@@ -577,7 +577,8 @@ out:static int ecryptfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {int rc;struct dentry *lower_old_dentry;
@@ -587,6 +588,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct dentry *trap =NULL ;struct inode *target_inode; +if (flags) +return -EINVAL ; + lower_old_dentry =ecryptfs_dentry_to_lower (old_dentry); lower_new_dentry =ecryptfs_dentry_to_lower (new_dentry);dget (lower_old_dentry);
@@ -1104,7 +1108,7 @@ const struct inode_operations ecryptfs_dir_iops = { .mkdir = ecryptfs_mkdir, .rmdir = ecryptfs_rmdir, .mknod = ecryptfs_mknod, - .rename = ecryptfs_rename, + .rename2 = ecryptfs_rename, .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, .setxattr = ecryptfs_setxattr,
fs/exofs/namei.c +6 -2
@@ -227,7 +227,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry) }static int exofs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);
@@ -237,6 +238,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,struct exofs_dir_entry *old_de;int err = -ENOENT ; +if (flags) +return -EINVAL ; + old_de =exofs_find_entry (old_dir, old_dentry, &old_page);if (!old_de) goto out;
@@ -310,7 +314,7 @@ const struct inode_operations exofs_dir_inode_operations = { .mkdir = exofs_mkdir, .rmdir = exofs_rmdir, .mknod = exofs_mknod, - .rename = exofs_rename, + .rename2 = exofs_rename, .setattr = exofs_setattr, };
fs/kernfs/dir.c +6 -2
@@ -1096,13 +1096,17 @@ static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry) }static int kernfs_iop_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct kernfs_node *kn = old_dentry->d_fsdata;struct kernfs_node *new_parent = new_dir->i_private;struct kernfs_syscall_ops *scops =kernfs_root (kn)->syscall_ops;int ret; +if (flags) +return -EINVAL ; +if (!scops || !scops->rename)return -EPERM ;
@@ -1133,7 +1137,7 @@ const struct inode_operations kernfs_dir_iops = { .mkdir = kernfs_iop_mkdir, .rmdir = kernfs_iop_rmdir, - .rename = kernfs_iop_rename, + .rename2 = kernfs_iop_rename, };static struct kernfs_node *kernfs_leftmost_descendant (struct kernfs_node *pos)
fs/ncpfs/dir.c +7 -3
@@ -36,7 +36,7 @@ static int ncp_unlink(struct inode *, struct dentry *);static int ncp_mkdir (struct inode *,struct dentry *,umode_t );static int ncp_rmdir (struct inode *,struct dentry *);static int ncp_rename (struct inode *,struct dentry *, -struct inode *,struct dentry *); +struct inode *,struct dentry *,unsigned int );static int ncp_mknod (struct inode * dir,struct dentry *dentry,umode_t mode,dev_t rdev);#if defined(CONFIG_NCPFS_EXTRAS ) || defined(CONFIG_NCPFS_NFS_NS )
@@ -65,7 +65,7 @@ const struct inode_operations ncp_dir_inode_operations = .mkdir = ncp_mkdir, .rmdir = ncp_rmdir, .mknod = ncp_mknod, - .rename = ncp_rename, + .rename2 = ncp_rename, .setattr = ncp_notify_change, };
@@ -1105,13 +1105,17 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry) }static int ncp_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct ncp_server *server =NCP_SERVER (old_dir);int error;int old_len, new_len;__u8 __old_name[NCP_MAXPATHLEN +1 ], __new_name[NCP_MAXPATHLEN +1 ]; +if (flags) +return -EINVAL ; +ncp_dbg (1 ,"%pd2 to %pd2\n" , old_dentry, new_dentry);ncp_age_dentry (server, old_dentry);
fs/nfs/dir.c +5 -1
@@ -2013,7 +2013,8 @@ EXPORT_SYMBOL_GPL(nfs_link);* the rename. */ int nfs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);
@@ -2021,6 +2022,9 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,struct rpc_task *task;int error = -EBUSY ; +if (flags) +return -EINVAL ; +dfprintk (VFS ,"NFS: rename(%pd2 -> %pd2, ct=%d)\n" , old_dentry, new_dentry,d_count (new_dentry));
fs/nfs/internal.h +2 -1
@@ -356,7 +356,8 @@ int nfs_unlink(struct inode *, struct dentry *);int nfs_symlink (struct inode *,struct dentry *,const char *);int nfs_link (struct dentry *,struct inode *,struct dentry *);int nfs_mknod (struct inode *,struct dentry *,umode_t ,dev_t ); -int nfs_rename (struct inode *,struct dentry *,struct inode *,struct dentry *); +int nfs_rename (struct inode *,struct dentry *, +struct inode *,struct dentry *,unsigned int );/* file.c */ int nfs_file_fsync (struct file *file,loff_t start,loff_t end,int datasync);
fs/nfs/nfs3proc.c +1 -1
@@ -893,7 +893,7 @@ static const struct inode_operations nfs3_dir_inode_operations = { .mkdir = nfs_mkdir, .rmdir = nfs_rmdir, .mknod = nfs_mknod, - .rename = nfs_rename, + .rename2 = nfs_rename, .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr,
fs/nfs/nfs4proc.c +1 -1
@@ -8867,7 +8867,7 @@ static const struct inode_operations nfs4_dir_inode_operations = { .mkdir = nfs_mkdir, .rmdir = nfs_rmdir, .mknod = nfs_mknod, - .rename = nfs_rename, + .rename2 = nfs_rename, .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr,
fs/nfs/proc.c +1 -1
@@ -685,7 +685,7 @@ static const struct inode_operations nfs_dir_inode_operations = { .mkdir = nfs_mkdir, .rmdir = nfs_rmdir, .mknod = nfs_mknod, - .rename = nfs_rename, + .rename2 = nfs_rename, .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr,
fs/ocfs2/namei.c +6 -2
@@ -1203,7 +1203,8 @@ static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2)static int ocfs2_rename (struct inode *old_dir,struct dentry *old_dentry,struct inode *new_dir, -struct dentry *new_dentry) +struct dentry *new_dentry, +unsigned int flags) {int status =0 , rename_lock =0 , parents_locked =0 , target_exists =0 ;int old_child_locked =0 , new_child_locked =0 , update_dot_dot =0 ;
@@ -1228,6 +1229,9 @@ static int ocfs2_rename(struct inode *old_dir,struct ocfs2_dir_lookup_result target_insert = {NULL , };bool should_add_orphan = false; +if (flags) +return -EINVAL ; +/* At some point it might be nice to break this function up a * bit. */
@@ -2909,7 +2913,7 @@ const struct inode_operations ocfs2_dir_iops = { .symlink = ocfs2_symlink, .mkdir = ocfs2_mkdir, .mknod = ocfs2_mknod, - .rename = ocfs2_rename, + .rename2 = ocfs2_rename, .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission,
fs/orangefs/namei.c +6 -2
@@ -409,11 +409,15 @@ out:static int orangefs_rename (struct inode *old_dir,struct dentry *old_dentry,struct inode *new_dir, -struct dentry *new_dentry) +struct dentry *new_dentry, +unsigned int flags) {struct orangefs_kernel_op_s *new_op;int ret; +if (flags) +return -EINVAL ; +gossip_debug (GOSSIP_NAME_DEBUG ,"orangefs_rename: called (%pd2 => %pd2) ct=%d\n" , old_dentry, new_dentry,d_count (new_dentry));
@@ -459,7 +463,7 @@ const struct inode_operations orangefs_dir_inode_operations = { .symlink = orangefs_symlink, .mkdir = orangefs_mkdir, .rmdir = orangefs_unlink, - .rename = orangefs_rename, + .rename2 = orangefs_rename, .setattr = orangefs_setattr, .getattr = orangefs_getattr, .setxattr = generic_setxattr,
Signature · 1 line
2.5.5
Re: [PATCH 4/7] fs: make remaining filesystems use .rename2
Quoted 19 lines · Miklos Szeredi
This is trivial to do:
- add flags argument to
foo_rename()
- check if flags is zero
- assignfoo_rename()to .rename2 instead of .renameThis doesn't mean it's impossible to support
RENAME_NOREPLACEfor these filesystems, but it is not trivial, like for local filesystems.RENAME_NOREPLACEmust guarantee atomicity (i.e. it shouldn't be possible for a file to be created on one host while it is overwritten by rename on another host).Filesystems converted:
9p, afs, ceph, coda, ecryptfs, exofs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs.
After this, we can get rid of the duplicate interfaces for rename.
Quoted 12 lines
Signed-off-by Miklos Szeredi <[email protected]>Cc Eric Van Hensbergen <[email protected]>Cc David Howells <[email protected]>Cc Ilya Dryomov <[email protected]>Cc Jan Harkes <[email protected]>Cc Tyler Hicks <[email protected]>Cc Boaz Harrosh <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Oleg Drokin <[email protected]>Cc Trond Myklebust <[email protected]>Cc Mark Fasheh <[email protected]>Cc Mike Marshall <[email protected]>
Re: [PATCH 4/7] fs: make remaining filesystems use .rename2
I looked at this in today's linux-next and ran a few renames through...
Quoted 34 lines · Greg Kroah-Hartman
Quoted 19 lines · Miklos Szeredi
This is trivial to do:
- add flags argument to
foo_rename()
- check if flags is zero
- assignfoo_rename()to .rename2 instead of .renameThis doesn't mean it's impossible to support
RENAME_NOREPLACEfor these filesystems, but it is not trivial, like for local filesystems.RENAME_NOREPLACEmust guarantee atomicity (i.e. it shouldn't be possible for a file to be created on one host while it is overwritten by rename on another host).Filesystems converted:
9p, afs, ceph, coda, ecryptfs, exofs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs.
After this, we can get rid of the duplicate interfaces for rename.
Quoted 12 lines
Signed-off-by Miklos Szeredi <[email protected]>Cc Eric Van Hensbergen <[email protected]>Cc David Howells <[email protected]>Cc Ilya Dryomov <[email protected]>Cc Jan Harkes <[email protected]>Cc Tyler Hicks <[email protected]>Cc Boaz Harrosh <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Oleg Drokin <[email protected]>Cc Trond Myklebust <[email protected]>Cc Mark Fasheh <[email protected]>Cc Mike Marshall <[email protected]>
Re: [PATCH 4/7] fs: make remaining filesystems use .rename2
In reply to Miklos SzerediQuoted 19 lines · Miklos Szeredi
This is trivial to do:
- add flags argument to
foo_rename()
- check if flags is zero
- assignfoo_rename()to .rename2 instead of .renameThis doesn't mean it's impossible to support
RENAME_NOREPLACEfor these filesystems, but it is not trivial, like for local filesystems.RENAME_NOREPLACEmust guarantee atomicity (i.e. it shouldn't be possible for a file to be created on one host while it is overwritten by rename on another host).Filesystems converted:
9p, afs, ceph, coda, ecryptfs, exofs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs.
After this, we can get rid of the duplicate interfaces for rename.
Quoted 11 lines
Signed-off-by Miklos Szeredi <[email protected]>Cc Eric Van Hensbergen <[email protected]>Cc Ilya Dryomov <[email protected]>Cc Jan Harkes <[email protected]>Cc Tyler Hicks <[email protected]>Cc Boaz Harrosh <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Oleg Drokin <[email protected]>Cc Trond Myklebust <[email protected]>Cc Mark Fasheh <[email protected]>Cc Mike Marshall <[email protected]>
Re: [PATCH 4/7] fs: make remaining filesystems use .rename2
In reply to Miklos SzerediQuoted 19 lines · Miklos Szeredi
This is trivial to do:
- add flags argument to
foo_rename()
- check if flags is zero
- assignfoo_rename()to .rename2 instead of .renameThis doesn't mean it's impossible to support
RENAME_NOREPLACEfor these filesystems, but it is not trivial, like for local filesystems.RENAME_NOREPLACEmust guarantee atomicity (i.e. it shouldn't be possible for a file to be created on one host while it is overwritten by rename on another host).Filesystems converted:
9p, afs, ceph, coda, ecryptfs, exofs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs.
After this, we can get rid of the duplicate interfaces for rename.
Quoted 7 lines
Signed-off-by Miklos Szeredi <[email protected]>Cc Eric Van Hensbergen <[email protected]>Cc David Howells <[email protected]>Cc Ilya Dryomov <[email protected]>Cc Jan Harkes <[email protected]>Cc Tyler Hicks <[email protected]>Cc Boaz Harrosh <[email protected]>
Hi exofs is not a distributed file system in the nfs-client sense. All meta-data operations happen on the single exofs mount. The distribution of an exofs cluster is done by an NFSD-like daemon that supports pNFS, and an std pNFS-client.
So the code you see below is just the same as an ext4 FS with a raid of iscsi devices below it. (Even if then later this FS is exported by an NFSD server)
That said it is fine as is don't sweat over this unused FS so:
<>
Quoted 25 lines
fs/exofs/namei.c +5
-1@@ -227,7 +227,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry) }static int exofs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);@@ -237,6 +238,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,struct exofs_dir_entry *old_de;int err = -ENOENT ; +if (flags) +return -EINVAL ; + old_de =exofs_find_entry (old_dir, old_dentry, &old_page);if (!old_de) goto out;
fs/exofs/namei.c const struct inode_operations exofs_dir_inode_operations = { · line 320
Quoted 8 lines
fs/exofs/namei.c +1
-1@@ -310,7 +314,7 @@ const struct inode_operations exofs_dir_inode_operations = { .mkdir = exofs_mkdir, .rmdir = exofs_rmdir, .mknod = exofs_mknod, - .rename = exofs_rename, + .rename2 = exofs_rename, .setattr = exofs_setattr, };
<>
Re: [PATCH 4/7] fs: make remaining filesystems use .rename2
Quoted 59 lines · Boaz Harrosh
Quoted 19 lines · Miklos Szeredi
This is trivial to do:
- add flags argument to
foo_rename()
- check if flags is zero
- assignfoo_rename()to .rename2 instead of .renameThis doesn't mean it's impossible to support
RENAME_NOREPLACEfor these filesystems, but it is not trivial, like for local filesystems.RENAME_NOREPLACEmust guarantee atomicity (i.e. it shouldn't be possible for a file to be created on one host while it is overwritten by rename on another host).Filesystems converted:
9p, afs, ceph, coda, ecryptfs, exofs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs.
After this, we can get rid of the duplicate interfaces for rename.
Quoted 7 lines
Signed-off-by Miklos Szeredi <[email protected]>Cc Eric Van Hensbergen <[email protected]>Cc David Howells <[email protected]>Cc Ilya Dryomov <[email protected]>Cc Jan Harkes <[email protected]>Cc Tyler Hicks <[email protected]>Cc Boaz Harrosh <[email protected]>Hi exofs is not a distributed file system in the nfs-client sense. All meta-data operations happen on the single exofs mount. The distribution of an exofs cluster is done by an NFSD-like daemon that supports pNFS, and an std pNFS-client.
So the code you see below is just the same as an ext4 FS with a raid of iscsi devices below it. (Even if then later this FS is exported by an NFSD server)That said it is fine as is don't sweat over this unused FS so:
<>
Quoted 18 lines
fs/exofs/namei.c +2
-1@@ -227,7 +227,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry) }static int exofs_rename (struct inode *old_dir,struct dentry *old_dentry, -struct inode *new_dir,struct dentry *new_dentry) +struct inode *new_dir,struct dentry *new_dentry, +unsigned int flags) {struct inode *old_inode =d_inode (old_dentry);struct inode *new_inode =d_inode (new_dentry);@@ -237,6 +238,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,struct exofs_dir_entry *old_de;int err = -ENOENT ;
Quoted 3 lines
fs/exofs/namei.c static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, · line 243
Quoted 3 lines
fs/exofs/namei.c +3
-0+if (flags) +return -EINVAL ; +
+ if (flags & ~RENAME_NOREPLACE)
+ return -EINVAL;
+
And move to the other patch if you feel like it
Quoted 14 lines
fs/exofs/namei.c const struct inode_operations exofs_dir_inode_operations = { · line 320
Quoted 12 lines
fs/exofs/namei.c +1
-1old_de =exofs_find_entry (old_dir, old_dentry, &old_page);if (!old_de) goto out;@@ -310,7 +314,7 @@ const struct inode_operations exofs_dir_inode_operations = { .mkdir = exofs_mkdir, .rmdir = exofs_rmdir, .mknod = exofs_mknod, - .rename = exofs_rename, + .rename2 = exofs_rename, .setattr = exofs_setattr, };<>
PATCH 5/7 vfs: remove unused i_op->rename
In reply to Miklos SzerediNo in-tree uses remain.
--- Documentation/filesystems/Locking | 6 +----- Documentation/filesystems/directory-locking | 2 +- Documentation/filesystems/vfs.txt | 9 ++------- fs/cachefiles/namei.c | 3 +-- fs/namei.c | 15 +++------------ include/linux/fs.h | 2 -- security/tomoyo/realpath.c | 4 ++-- 7 files changed, 10 insertions(+), 31 deletions(-)
Documentation/filesystems/Locking +1 -5
@@ -50,8 +50,6 @@ prototypes: int (*mkdir) (struct inode *,struct dentry *,umode_t); int (*rmdir) (struct inode *,struct dentry *); int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename) (struct inode *, struct dentry *, - struct inode *, struct dentry *); int (*rename2) (struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*readlink) (struct dentry *, char __user *,int);
@@ -83,7 +81,6 @@ symlink: yes mkdir: yes unlink: yes (both) rmdir: yes (both) (see below) -rename: yes (all) (see below) rename2: yes (all) (see below) readlink: no get_link: no
@@ -102,8 +99,7 @@ tmpfile: no Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on victim. - cross-directory ->rename() and rename2() has (per-superblock) -->s_vfs_rename_sem. + cross-directory ->rename2() has (per-superblock) ->s_vfs_rename_sem. See Documentation/filesystems/directory-locking for more detailed discussion of the locking scheme for directory operations.
Documentation/filesystems/directory-locking +1 -1
@@ -19,7 +19,7 @@ locks victim and calls the method. Locks are exclusive. 4) rename() that is _not_ cross-directory. Locking rules: caller locks the parent and finds source and target. In case of exchange (with -RENAME_EXCHANGE in rename2() flags argument) lock both. In any case, +RENAME_EXCHANGE in flags argument) lock both. In any case, if the target already exists, lock it. If the source is a non-directory, lock it. If we need to lock both, lock them in inode pointer order. Then call the method. All locks are exclusive.
Documentation/filesystems/vfs.txt +2 -7
@@ -345,8 +345,6 @@ struct inode_operations { int (*mkdir) (struct inode *,struct dentry *,umode_t); int (*rmdir) (struct inode *,struct dentry *); int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename) (struct inode *, struct dentry *, - struct inode *, struct dentry *); int (*rename2) (struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*readlink) (struct dentry *, char __user *,int);
@@ -416,11 +414,8 @@ otherwise noted. rename: called by the rename(2) system call to rename the object to have the parent and name given by the second inode and dentry. - rename2: this has an additional flags argument compared to rename. - If no flags are supported by the filesystem then this method - need not be implemented. If some flags are supported then the - filesystem must return -EINVAL for any unsupported or unknown - flags. Currently the following flags are implemented: + The filesystem must return -EINVAL for any unsupported or + unknown flags. Currently the following flags are implemented: (1) RENAME_NOREPLACE: this flag indicates that if the target of the rename exists the rename should fail with -EEXIST instead of replacing the target. The VFS already checks for
fs/cachefiles/namei.c +1 -2
@@ -804,8 +804,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, !d_backing_inode (subdir)->i_op->lookup || !d_backing_inode (subdir)->i_op->mkdir || !d_backing_inode (subdir)->i_op->create || - (!d_backing_inode (subdir)->i_op->rename && - !d_backing_inode (subdir)->i_op->rename2) || + !d_backing_inode (subdir)->i_op->rename2 || !d_backing_inode (subdir)->i_op->rmdir || !d_backing_inode(subdir)->i_op->unlink) goto check_error;
fs/namei.c +3 -12
@@ -4369,12 +4369,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,if (error)return error; -if (!old_dir->i_op->rename && !old_dir->i_op->rename2) +if (!old_dir->i_op->rename2)return -EPERM ; -if (flags && !old_dir->i_op->rename2) -return -EINVAL ; -/* * If we are going to change the parent - check write permissions, * we'll need to flip '..'.
@@ -4428,14 +4425,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,if (error) goto out; } -if (!old_dir->i_op->rename2) { - error = old_dir->i_op->rename (old_dir, old_dentry, - new_dir, new_dentry); - }else { -WARN_ON (old_dir->i_op->rename !=NULL ); - error = old_dir->i_op->rename2 (old_dir, old_dentry, - new_dir, new_dentry, flags); - } + error = old_dir->i_op->rename2 (old_dir, old_dentry, + new_dir, new_dentry, flags);if (error) goto out;
include/linux/fs.h +0 -2
@@ -1731,8 +1731,6 @@ struct inode_operations {int (*mkdir) (struct inode *,struct dentry *,umode_t );int (*rmdir) (struct inode *,struct dentry *);int (*mknod) (struct inode *,struct dentry *,umode_t ,dev_t ); -int (*rename) (struct inode *,struct dentry *, -struct inode *,struct dentry *);int (*rename2) (struct inode *,struct dentry *,struct inode *,struct dentry *,unsigned int );int (*setattr) (struct dentry *,struct iattr *);
security/tomoyo/realpath.c +2 -2
@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,* Use filesystem name if filesystem does not support rename() * operation. */ -if (!inode->i_op->rename && !inode->i_op->rename2) +if (!inode->i_op->rename2) goto prepend_filesystem_name; }/* Prepend device name. */
@@ -283,7 +283,7 @@ char *tomoyo_realpath_from_path(const struct path *path)* or dentry without vfsmount. */ if (!path->mnt || - (!inode->i_op->rename && !inode->i_op->rename2)) + (!inode->i_op->rename2)) pos =tomoyo_get_local_path (path->dentry, buf, buf_len -1 );/* Get absolute name for the rest. */
Signature · 1 line
2.5.5
PATCH 6/7 fs: rename "rename2" i_op to "rename"
In reply to Miklos SzerediGenerated patch:
sed -i "s/\.rename2\t/\.rename\t\t/" git grep -wl rename2 sed -i "s/\brename2\b/rename/g" git grep -wl rename2
--- Documentation/filesystems/Locking | 6 +++--- Documentation/filesystems/vfs.txt | 2 +- drivers/staging/lustre/lustre/llite/namei.c | 2 +- fs/9p/vfs_inode.c | 4 ++-- fs/9p/vfs_inode_dotl.c | 2 +- fs/affs/dir.c | 2 +- fs/afs/dir.c | 2 +- fs/bad_inode.c | 2 +- fs/bfs/dir.c | 2 +- fs/btrfs/inode.c | 2 +- fs/cachefiles/namei.c | 2 +- fs/ceph/dir.c | 4 ++-- fs/cifs/cifsfs.c | 2 +- fs/coda/dir.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/exofs/namei.c | 2 +- fs/ext2/namei.c | 2 +- fs/ext4/namei.c | 2 +- fs/f2fs/namei.c | 2 +- fs/fat/namei_msdos.c | 2 +- fs/fat/namei_vfat.c | 2 +- fs/fuse/dir.c | 2 +- fs/gfs2/inode.c | 2 +- fs/hfs/dir.c | 2 +- fs/hfsplus/dir.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/namei.c | 2 +- fs/hugetlbfs/inode.c | 2 +- fs/jffs2/dir.c | 2 +- fs/jfs/namei.c | 2 +- fs/kernfs/dir.c | 2 +- fs/logfs/dir.c | 2 +- fs/minix/namei.c | 2 +- fs/namei.c | 4 ++-- fs/ncpfs/dir.c | 2 +- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 2 +- fs/nfs/proc.c | 2 +- fs/nilfs2/namei.c | 2 +- fs/ocfs2/namei.c | 2 +- fs/omfs/dir.c | 2 +- fs/orangefs/namei.c | 2 +- fs/overlayfs/dir.c | 2 +- fs/overlayfs/overlayfs.h | 4 ++-- fs/ramfs/inode.c | 2 +- fs/reiserfs/namei.c | 2 +- fs/sysv/namei.c | 2 +- fs/ubifs/dir.c | 2 +- fs/udf/namei.c | 2 +- fs/ufs/namei.c | 2 +- fs/xfs/xfs_iops.c | 4 ++-- include/linux/fs.h | 2 +- kernel/bpf/inode.c | 2 +- mm/shmem.c | 2 +- security/tomoyo/realpath.c | 4 ++-- 55 files changed, 63 insertions(+), 63 deletions(-)
Documentation/filesystems/Locking +3 -3
@@ -50,7 +50,7 @@ prototypes: int (*mkdir) (struct inode *,struct dentry *,umode_t); int (*rmdir) (struct inode *,struct dentry *); int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename2) (struct inode *, struct dentry *, + int (*rename) (struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*readlink) (struct dentry *, char __user *,int); const char *(*get_link) (struct dentry *, struct inode *, void **);
@@ -81,7 +81,7 @@ symlink: yes mkdir: yes unlink: yes (both) rmdir: yes (both) (see below) -rename2: yes (all) (see below) +rename: yes (all) (see below) readlink: no get_link: no setattr: yes
@@ -99,7 +99,7 @@ tmpfile: no Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on victim. - cross-directory ->rename2() has (per-superblock) ->s_vfs_rename_sem. + cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. See Documentation/filesystems/directory-locking for more detailed discussion of the locking scheme for directory operations.
Documentation/filesystems/vfs.txt +1 -1
@@ -345,7 +345,7 @@ struct inode_operations { int (*mkdir) (struct inode *,struct dentry *,umode_t); int (*rmdir) (struct inode *,struct dentry *); int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); - int (*rename2) (struct inode *, struct dentry *, + int (*rename) (struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); int (*readlink) (struct dentry *, char __user *,int); const char *(*get_link) (struct dentry *, struct inode *,
drivers/staging/lustre/lustre/llite/namei.c +1 -1
@@ -1101,7 +1101,7 @@ const struct inode_operations ll_dir_inode_operations = { .rmdir = ll_rmdir, .symlink = ll_symlink, .link = ll_link, - .rename2 = ll_rename, + .rename = ll_rename, .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission,
fs/9p/vfs_inode.c +2 -2
@@ -1440,7 +1440,7 @@ static const struct inode_operations v9fs_dir_inode_operations_dotu = { .mkdir = v9fs_vfs_mkdir, .rmdir = v9fs_vfs_rmdir, .mknod = v9fs_vfs_mknod, - .rename2 = v9fs_vfs_rename, + .rename = v9fs_vfs_rename, .getattr = v9fs_vfs_getattr, .setattr = v9fs_vfs_setattr, };
@@ -1453,7 +1453,7 @@ static const struct inode_operations v9fs_dir_inode_operations = { .mkdir = v9fs_vfs_mkdir, .rmdir = v9fs_vfs_rmdir, .mknod = v9fs_vfs_mknod, - .rename2 = v9fs_vfs_rename, + .rename = v9fs_vfs_rename, .getattr = v9fs_vfs_getattr, .setattr = v9fs_vfs_setattr, };
fs/9p/vfs_inode_dotl.c +1 -1
@@ -964,7 +964,7 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = { .mkdir = v9fs_vfs_mkdir_dotl, .rmdir = v9fs_vfs_rmdir, .mknod = v9fs_vfs_mknod_dotl, - .rename2 = v9fs_vfs_rename, + .rename = v9fs_vfs_rename, .getattr = v9fs_vfs_getattr_dotl, .setattr = v9fs_vfs_setattr_dotl, .setxattr = generic_setxattr,
fs/affs/dir.c +1 -1
@@ -35,7 +35,7 @@ const struct inode_operations affs_dir_inode_operations = { .symlink = affs_symlink, .mkdir = affs_mkdir, .rmdir = affs_rmdir, - .rename2 = affs_rename, + .rename = affs_rename, .setattr = affs_notify_change, };
fs/afs/dir.c +1 -1
@@ -57,7 +57,7 @@ const struct inode_operations afs_dir_inode_operations = { .symlink = afs_symlink, .mkdir = afs_mkdir, .rmdir = afs_rmdir, - .rename2 = afs_rename, + .rename = afs_rename, .permission = afs_permission, .getattr = afs_getattr, .setattr = afs_setattr,
fs/bad_inode.c +1 -1
@@ -133,7 +133,7 @@ static const struct inode_operations bad_inode_ops = .mkdir = bad_inode_mkdir, .rmdir = bad_inode_rmdir, .mknod = bad_inode_mknod, - .rename2 = bad_inode_rename2, + .rename = bad_inode_rename2, .readlink = bad_inode_readlink,/* follow_link must be no-op, otherwise unmounting this inode won't work */
fs/bfs/dir.c +1 -1
@@ -274,7 +274,7 @@ const struct inode_operations bfs_dir_inops = { .lookup = bfs_lookup, .link = bfs_link, .unlink = bfs_unlink, - .rename2 = bfs_rename, + .rename = bfs_rename, }; static int bfs_add_entry(struct inode *dir, const unsigned char *name,
fs/btrfs/inode.c +1 -1
@@ -10549,7 +10549,7 @@ static const struct inode_operations btrfs_dir_inode_operations = { .link = btrfs_link, .mkdir = btrfs_mkdir, .rmdir = btrfs_rmdir, - .rename2 = btrfs_rename2, + .rename = btrfs_rename2, .symlink = btrfs_symlink, .setattr = btrfs_setattr, .mknod = btrfs_mknod,
fs/cachefiles/namei.c +1 -1
@@ -804,7 +804,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, !d_backing_inode (subdir)->i_op->lookup || !d_backing_inode (subdir)->i_op->mkdir || !d_backing_inode (subdir)->i_op->create || - !d_backing_inode (subdir)->i_op->rename2 || + !d_backing_inode (subdir)->i_op->rename || !d_backing_inode (subdir)->i_op->rmdir || !d_backing_inode(subdir)->i_op->unlink) goto check_error;
fs/ceph/dir.c +2 -2
@@ -1502,7 +1502,7 @@ const struct inode_operations ceph_dir_iops = { .link = ceph_link, .unlink = ceph_unlink, .rmdir = ceph_unlink, - .rename2 = ceph_rename, + .rename = ceph_rename, .create = ceph_create, .atomic_open = ceph_atomic_open, };
@@ -1513,7 +1513,7 @@ const struct inode_operations ceph_snapdir_iops = { .getattr = ceph_getattr, .mkdir = ceph_mkdir, .rmdir = ceph_unlink, - .rename2 = ceph_rename, + .rename = ceph_rename, };const struct dentry_operations ceph_dentry_ops = {
fs/cifs/cifsfs.c +1 -1
@@ -901,7 +901,7 @@ const struct inode_operations cifs_dir_inode_ops = { .link = cifs_hardlink, .mkdir = cifs_mkdir, .rmdir = cifs_rmdir, - .rename2 = cifs_rename2, + .rename = cifs_rename2, .permission = cifs_permission, .setattr = cifs_setattr, .symlink = cifs_symlink,
fs/coda/dir.c +1 -1
@@ -573,7 +573,7 @@ const struct inode_operations coda_dir_inode_operations = { .mkdir = coda_mkdir, .rmdir = coda_rmdir, .mknod = CODA_EIO_ERROR, - .rename2 = coda_rename, + .rename = coda_rename, .permission = coda_permission, .getattr = coda_getattr, .setattr = coda_setattr,
fs/ecryptfs/inode.c +1 -1
@@ -1108,7 +1108,7 @@ const struct inode_operations ecryptfs_dir_iops = { .mkdir = ecryptfs_mkdir, .rmdir = ecryptfs_rmdir, .mknod = ecryptfs_mknod, - .rename2 = ecryptfs_rename, + .rename = ecryptfs_rename, .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, .setxattr = ecryptfs_setxattr,
fs/exofs/namei.c +1 -1
@@ -314,7 +314,7 @@ const struct inode_operations exofs_dir_inode_operations = { .mkdir = exofs_mkdir, .rmdir = exofs_rmdir, .mknod = exofs_mknod, - .rename2 = exofs_rename, + .rename = exofs_rename, .setattr = exofs_setattr, };
fs/ext2/namei.c +1 -1
@@ -430,7 +430,7 @@ const struct inode_operations ext2_dir_inode_operations = { .mkdir = ext2_mkdir, .rmdir = ext2_rmdir, .mknod = ext2_mknod, - .rename2 = ext2_rename, + .rename = ext2_rename, #ifdef CONFIG_EXT2_FS_XATTR .setxattr = generic_setxattr, .getxattr = generic_getxattr,
fs/ext4/namei.c +1 -1
@@ -3880,7 +3880,7 @@ const struct inode_operations ext4_dir_inode_operations = { .rmdir = ext4_rmdir, .mknod = ext4_mknod, .tmpfile = ext4_tmpfile, - .rename2 = ext4_rename2, + .rename = ext4_rename2, .setattr = ext4_setattr, .setxattr = generic_setxattr, .getxattr = generic_getxattr,
fs/f2fs/namei.c +1 -1
@@ -1093,7 +1093,7 @@ const struct inode_operations f2fs_dir_inode_operations = { .mkdir = f2fs_mkdir, .rmdir = f2fs_rmdir, .mknod = f2fs_mknod, - .rename2 = f2fs_rename2, + .rename = f2fs_rename2, .tmpfile = f2fs_tmpfile, .getattr = f2fs_getattr, .setattr = f2fs_setattr,
fs/fat/namei_msdos.c +1 -1
@@ -637,7 +637,7 @@ static const struct inode_operations msdos_dir_inode_operations = { .unlink = msdos_unlink, .mkdir = msdos_mkdir, .rmdir = msdos_rmdir, - .rename2 = msdos_rename, + .rename = msdos_rename, .setattr = fat_setattr, .getattr = fat_getattr, };
fs/fat/namei_vfat.c +1 -1
@@ -1040,7 +1040,7 @@ static const struct inode_operations vfat_dir_inode_operations = { .unlink = vfat_unlink, .mkdir = vfat_mkdir, .rmdir = vfat_rmdir, - .rename2 = vfat_rename, + .rename = vfat_rename, .setattr = fat_setattr, .getattr = fat_getattr, };
fs/fuse/dir.c +1 -1
@@ -1876,7 +1876,7 @@ static const struct inode_operations fuse_dir_inode_operations = { .symlink = fuse_symlink, .unlink = fuse_unlink, .rmdir = fuse_rmdir, - .rename2 = fuse_rename2, + .rename = fuse_rename2, .link = fuse_link, .setattr = fuse_setattr, .create = fuse_create,
fs/gfs2/inode.c +1 -1
@@ -2054,7 +2054,7 @@ const struct inode_operations gfs2_dir_iops = { .mkdir = gfs2_mkdir, .rmdir = gfs2_unlink, .mknod = gfs2_mknod, - .rename2 = gfs2_rename2, + .rename = gfs2_rename2, .permission = gfs2_permission, .setattr = gfs2_setattr, .getattr = gfs2_getattr,
fs/hfs/dir.c +1 -1
@@ -324,6 +324,6 @@ const struct inode_operations hfs_dir_inode_operations = { .unlink = hfs_remove, .mkdir = hfs_mkdir, .rmdir = hfs_remove, - .rename2 = hfs_rename, + .rename = hfs_rename, .setattr = hfs_inode_setattr, };
fs/hfsplus/dir.c +1 -1
@@ -565,7 +565,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { .rmdir = hfsplus_rmdir, .symlink = hfsplus_symlink, .mknod = hfsplus_mknod, - .rename2 = hfsplus_rename, + .rename = hfsplus_rename, .setxattr = generic_setxattr, .getxattr = generic_getxattr, .listxattr = hfsplus_listxattr,
fs/hostfs/hostfs_kern.c +1 -1
@@ -885,7 +885,7 @@ static const struct inode_operations hostfs_dir_iops = { .mkdir = hostfs_mkdir, .rmdir = hostfs_rmdir, .mknod = hostfs_mknod, - .rename2 = hostfs_rename2, + .rename = hostfs_rename2, .permission = hostfs_permission, .setattr = hostfs_setattr, };
fs/hpfs/namei.c +1 -1
@@ -622,6 +622,6 @@ const struct inode_operations hpfs_dir_iops = .mkdir = hpfs_mkdir, .rmdir = hpfs_rmdir, .mknod = hpfs_mknod, - .rename2 = hpfs_rename, + .rename = hpfs_rename, .setattr = hpfs_setattr, };
fs/hugetlbfs/inode.c +1 -1
@@ -988,7 +988,7 @@ static const struct inode_operations hugetlbfs_dir_inode_operations = { .mkdir = hugetlbfs_mkdir, .rmdir = simple_rmdir, .mknod = hugetlbfs_mknod, - .rename2 = simple_rename, + .rename = simple_rename, .setattr = hugetlbfs_setattr, };
fs/jffs2/dir.c +1 -1
@@ -58,7 +58,7 @@ const struct inode_operations jffs2_dir_inode_operations = .mkdir = jffs2_mkdir, .rmdir = jffs2_rmdir, .mknod = jffs2_mknod, - .rename2 = jffs2_rename, + .rename = jffs2_rename, .get_acl = jffs2_get_acl, .set_acl = jffs2_set_acl, .setattr = jffs2_setattr,
fs/jfs/namei.c +1 -1
@@ -1539,7 +1539,7 @@ const struct inode_operations jfs_dir_inode_operations = { .mkdir = jfs_mkdir, .rmdir = jfs_rmdir, .mknod = jfs_mknod, - .rename2 = jfs_rename, + .rename = jfs_rename, .setxattr = generic_setxattr, .getxattr = generic_getxattr, .listxattr = jfs_listxattr,
fs/kernfs/dir.c +1 -1
@@ -1137,7 +1137,7 @@ const struct inode_operations kernfs_dir_iops = { .mkdir = kernfs_iop_mkdir, .rmdir = kernfs_iop_rmdir, - .rename2 = kernfs_iop_rename, + .rename = kernfs_iop_rename, };static struct kernfs_node *kernfs_leftmost_descendant (struct kernfs_node *pos)
fs/logfs/dir.c +1 -1
@@ -787,7 +787,7 @@ const struct inode_operations logfs_dir_iops = { .lookup = logfs_lookup, .mkdir = logfs_mkdir, .mknod = logfs_mknod, - .rename2 = logfs_rename, + .rename = logfs_rename, .rmdir = logfs_rmdir, .symlink = logfs_symlink, .unlink = logfs_unlink,
fs/minix/namei.c +1 -1
@@ -268,7 +268,7 @@ const struct inode_operations minix_dir_inode_operations = { .mkdir = minix_mkdir, .rmdir = minix_rmdir, .mknod = minix_mknod, - .rename2 = minix_rename, + .rename = minix_rename, .getattr = minix_getattr, .tmpfile = minix_tmpfile, };
fs/namei.c +2 -2
@@ -4369,7 +4369,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,if (error)return error; -if (!old_dir->i_op->rename2) +if (!old_dir->i_op->rename)return -EPERM ;/*
@@ -4425,7 +4425,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,if (error) goto out; } - error = old_dir->i_op->rename2 (old_dir, old_dentry, + error = old_dir->i_op->rename (old_dir, old_dentry, new_dir, new_dentry, flags);if (error) goto out;
fs/ncpfs/dir.c +1 -1
@@ -65,7 +65,7 @@ const struct inode_operations ncp_dir_inode_operations = .mkdir = ncp_mkdir, .rmdir = ncp_rmdir, .mknod = ncp_mknod, - .rename2 = ncp_rename, + .rename = ncp_rename, .setattr = ncp_notify_change, };
fs/nfs/nfs3proc.c +1 -1
@@ -893,7 +893,7 @@ static const struct inode_operations nfs3_dir_inode_operations = { .mkdir = nfs_mkdir, .rmdir = nfs_rmdir, .mknod = nfs_mknod, - .rename2 = nfs_rename, + .rename = nfs_rename, .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr,
fs/nfs/nfs4proc.c +1 -1
@@ -8867,7 +8867,7 @@ static const struct inode_operations nfs4_dir_inode_operations = { .mkdir = nfs_mkdir, .rmdir = nfs_rmdir, .mknod = nfs_mknod, - .rename2 = nfs_rename, + .rename = nfs_rename, .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr,
fs/nfs/proc.c +1 -1
@@ -685,7 +685,7 @@ static const struct inode_operations nfs_dir_inode_operations = { .mkdir = nfs_mkdir, .rmdir = nfs_rmdir, .mknod = nfs_mknod, - .rename2 = nfs_rename, + .rename = nfs_rename, .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr,
fs/nilfs2/namei.c +1 -1
@@ -556,7 +556,7 @@ const struct inode_operations nilfs_dir_inode_operations = { .mkdir = nilfs_mkdir, .rmdir = nilfs_rmdir, .mknod = nilfs_mknod, - .rename2 = nilfs_rename, + .rename = nilfs_rename, .setattr = nilfs_setattr, .permission = nilfs_permission, .fiemap = nilfs_fiemap,
fs/ocfs2/namei.c +1 -1
@@ -2913,7 +2913,7 @@ const struct inode_operations ocfs2_dir_iops = { .symlink = ocfs2_symlink, .mkdir = ocfs2_mkdir, .mknod = ocfs2_mknod, - .rename2 = ocfs2_rename, + .rename = ocfs2_rename, .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission,
fs/omfs/dir.c +1 -1
@@ -448,7 +448,7 @@ static int omfs_readdir(struct file *file, struct dir_context *ctx)const struct inode_operations omfs_dir_inops = { .lookup = omfs_lookup, .mkdir = omfs_mkdir, - .rename2 = omfs_rename, + .rename = omfs_rename, .create = omfs_create, .unlink = omfs_remove, .rmdir = omfs_remove,
fs/orangefs/namei.c +1 -1
@@ -463,7 +463,7 @@ const struct inode_operations orangefs_dir_inode_operations = { .symlink = orangefs_symlink, .mkdir = orangefs_mkdir, .rmdir = orangefs_unlink, - .rename2 = orangefs_rename, + .rename = orangefs_rename, .setattr = orangefs_setattr, .getattr = orangefs_getattr, .setxattr = generic_setxattr,
fs/overlayfs/dir.c +1 -1
@@ -942,7 +942,7 @@ const struct inode_operations ovl_dir_inode_operations = { .symlink = ovl_symlink, .unlink = ovl_unlink, .rmdir = ovl_rmdir, - .rename2 = ovl_rename2, + .rename = ovl_rename2, .link = ovl_link, .setattr = ovl_setattr, .create = ovl_create,
fs/overlayfs/overlayfs.h +2 -2
@@ -114,13 +114,13 @@ static inline int ovl_do_rename(struct inode *olddir, struct dentry *olddentry, {int err; -pr_debug ("rename2(%pd2, %pd2, 0x%x)\n" , +pr_debug ("rename(%pd2, %pd2, 0x%x)\n" , olddentry, newdentry, flags); err =vfs_rename (olddir, olddentry, newdir, newdentry,NULL , flags);if (err) { -pr_debug ("...rename2(%pd2, %pd2, ...) = %i\n" , +pr_debug ("...rename(%pd2, %pd2, ...) = %i\n" , olddentry, newdentry, err); }return err;
fs/ramfs/inode.c +1 -1
@@ -146,7 +146,7 @@ static const struct inode_operations ramfs_dir_inode_operations = { .mkdir = ramfs_mkdir, .rmdir = simple_rmdir, .mknod = ramfs_mknod, - .rename2 = simple_rename, + .rename = simple_rename, };static const struct super_operations ramfs_ops = {
fs/reiserfs/namei.c +1 -1
@@ -1652,7 +1652,7 @@ const struct inode_operations reiserfs_dir_inode_operations = { .mkdir = reiserfs_mkdir, .rmdir = reiserfs_rmdir, .mknod = reiserfs_mknod, - .rename2 = reiserfs_rename, + .rename = reiserfs_rename, .setattr = reiserfs_setattr, .setxattr = generic_setxattr, .getxattr = generic_getxattr,
fs/sysv/namei.c +1 -1
@@ -289,6 +289,6 @@ const struct inode_operations sysv_dir_inode_operations = { .mkdir = sysv_mkdir, .rmdir = sysv_rmdir, .mknod = sysv_mknod, - .rename2 = sysv_rename, + .rename = sysv_rename, .getattr = sysv_getattr, };
fs/ubifs/dir.c +1 -1
@@ -1183,7 +1183,7 @@ const struct inode_operations ubifs_dir_inode_operations = { .mkdir = ubifs_mkdir, .rmdir = ubifs_rmdir, .mknod = ubifs_mknod, - .rename2 = ubifs_rename, + .rename = ubifs_rename, .setattr = ubifs_setattr, .getattr = ubifs_getattr, .setxattr = generic_setxattr,
fs/udf/namei.c +1 -1
@@ -1357,6 +1357,6 @@ const struct inode_operations udf_dir_inode_operations = { .mkdir = udf_mkdir, .rmdir = udf_rmdir, .mknod = udf_mknod, - .rename2 = udf_rename, + .rename = udf_rename, .tmpfile = udf_tmpfile, };
fs/ufs/namei.c +1 -1
@@ -337,5 +337,5 @@ const struct inode_operations ufs_dir_inode_operations = { .mkdir = ufs_mkdir, .rmdir = ufs_rmdir, .mknod = ufs_mknod, - .rename2 = ufs_rename, + .rename = ufs_rename, };
fs/xfs/xfs_iops.c +2 -2
@@ -1052,7 +1052,7 @@ static const struct inode_operations xfs_dir_inode_operations = {*/ .rmdir = xfs_vn_unlink, .mknod = xfs_vn_mknod, - .rename2 = xfs_vn_rename, + .rename = xfs_vn_rename, .get_acl = xfs_get_acl, .set_acl = xfs_set_acl, .getattr = xfs_vn_getattr,
@@ -1080,7 +1080,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {*/ .rmdir = xfs_vn_unlink, .mknod = xfs_vn_mknod, - .rename2 = xfs_vn_rename, + .rename = xfs_vn_rename, .get_acl = xfs_get_acl, .set_acl = xfs_set_acl, .getattr = xfs_vn_getattr,
include/linux/fs.h +1 -1
@@ -1731,7 +1731,7 @@ struct inode_operations {int (*mkdir) (struct inode *,struct dentry *,umode_t );int (*rmdir) (struct inode *,struct dentry *);int (*mknod) (struct inode *,struct dentry *,umode_t ,dev_t ); -int (*rename2) (struct inode *,struct dentry *, +int (*rename) (struct inode *,struct dentry *,struct inode *,struct dentry *,unsigned int );int (*setattr) (struct dentry *,struct iattr *);int (*getattr) (struct vfsmount *mnt,struct dentry *,struct kstat *);
kernel/bpf/inode.c +1 -1
@@ -189,7 +189,7 @@ static const struct inode_operations bpf_dir_iops = { .mknod = bpf_mkobj, .mkdir = bpf_mkdir, .rmdir = simple_rmdir, - .rename2 = simple_rename, + .rename = simple_rename, .link = simple_link, .unlink = simple_unlink, };
mm/shmem.c +1 -1
@@ -3813,7 +3813,7 @@ static const struct inode_operations shmem_dir_inode_operations = { .mkdir = shmem_mkdir, .rmdir = shmem_rmdir, .mknod = shmem_mknod, - .rename2 = shmem_rename2, + .rename = shmem_rename2, .tmpfile = shmem_tmpfile,#endif #ifdef CONFIG_TMPFS_XATTR
security/tomoyo/realpath.c +2 -2
@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer,* Use filesystem name if filesystem does not support rename() * operation. */ -if (!inode->i_op->rename2) +if (!inode->i_op->rename) goto prepend_filesystem_name; }/* Prepend device name. */
@@ -283,7 +283,7 @@ char *tomoyo_realpath_from_path(const struct path *path)* or dentry without vfsmount. */ if (!path->mnt || - (!inode->i_op->rename2)) + (!inode->i_op->rename)) pos =tomoyo_get_local_path (path->dentry, buf, buf_len -1 );/* Get absolute name for the rest. */
Signature · 1 line
2.5.5
PATCH 7/7 vfs: add note about i_op->rename changes to porting
In reply to Miklos Szeredi--- Documentation/filesystems/porting | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/filesystems/porting +4 -0
@@ -592,3 +592,7 @@ in your dentry operations instead. work just as well; if it's something more complicated, use dentry->d_parent. Just be careful not to assume that fetching it more than once will yield the same value - in RCU mode it could change under you. +-- +[mandatory] + ->rename() has an added flags argument. Any flags not handled by the + filesystem should result in EINVAL being returned.
Signature · 1 line
2.5.5