From 1cd66c93ba8cdb873258f58ae6a817b28a02bcc3 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 27 Sep 2016 11:03:58 +0200 Subject: fs: make remaining filesystems use .rename2 This 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, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs. After this, we can get rid of the duplicate interfaces for rename. Signed-off-by: Miklos Szeredi Acked-by: Greg Kroah-Hartman Acked-by: David Howells [AFS] Acked-by: Mike Marshall Cc: Eric Van Hensbergen Cc: Ilya Dryomov Cc: Jan Harkes Cc: Tyler Hicks Cc: Oleg Drokin Cc: Trond Myklebust Cc: Mark Fasheh --- fs/orangefs/namei.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 62c525936ee8..810d43635dfb 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -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, -- cgit v1.2.3 From 2773bf00aeb9bf39e022463272a61dd0ec9f55f4 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 27 Sep 2016 11:03:58 +0200 Subject: fs: rename "rename2" i_op to "rename" Generated patch: sed -i "s/\.rename2\t/\.rename\t\t/" `git grep -wl rename2` sed -i "s/\brename2\b/rename/g" `git grep -wl rename2` Signed-off-by: Miklos Szeredi --- fs/orangefs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 810d43635dfb..5f015c58bfa2 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -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, -- cgit v1.2.3 From 078cd8279e659989b103359bb22373cc79445bde Mon Sep 17 00:00:00 2001 From: Deepa Dinamani Date: Wed, 14 Sep 2016 07:48:04 -0700 Subject: fs: Replace CURRENT_TIME with current_time() for inode timestamps CURRENT_TIME macro is not appropriate for filesystems as it doesn't use the right granularity for filesystem timestamps. Use current_time() instead. CURRENT_TIME is also not y2038 safe. This is also in preparation for the patch that transitions vfs timestamps to use 64 bit time and hence make them y2038 safe. As part of the effort current_time() will be extended to do range checks. Hence, it is necessary for all file system timestamps to use current_time(). Also, current_time() will be transitioned along with vfs to be y2038 safe. Note that whenever a single call to current_time() is used to change timestamps in different inodes, it is because they share the same time granularity. Signed-off-by: Deepa Dinamani Reviewed-by: Arnd Bergmann Acked-by: Felipe Balbi Acked-by: Steven Whitehouse Acked-by: Ryusuke Konishi Acked-by: David Sterba Signed-off-by: Al Viro --- fs/orangefs/file.c | 2 +- fs/orangefs/inode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 526040e09f78..e799bb4474f6 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -358,7 +358,7 @@ out: file_accessed(file); } else { SetMtimeFlag(orangefs_inode); - inode->i_mtime = CURRENT_TIME; + inode->i_mtime = current_time(inode); mark_inode_dirty_sync(inode); } } diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 28a0557a69be..113d928d1223 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -438,7 +438,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir, inode->i_mode = mode; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); inode->i_size = PAGE_SIZE; inode->i_rdev = dev; -- cgit v1.2.3 From c2050a454c7f123d7a57fa1d76ff61bd43643abb Mon Sep 17 00:00:00 2001 From: Deepa Dinamani Date: Wed, 14 Sep 2016 07:48:06 -0700 Subject: fs: Replace current_fs_time() with current_time() current_fs_time() uses struct super_block* as an argument. As per Linus's suggestion, this is changed to take struct inode* as a parameter instead. This is because the function is primarily meant for vfs inode timestamps. Also the function was renamed as per Arnd's suggestion. Change all calls to current_fs_time() to use the new current_time() function instead. current_fs_time() will be deleted. Signed-off-by: Deepa Dinamani Signed-off-by: Al Viro --- fs/orangefs/namei.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 62c525936ee8..e1ab95529231 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -81,7 +81,7 @@ static int orangefs_create(struct inode *dir, dentry->d_name.name); SetMtimeFlag(parent); - dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); + dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty_sync(dir); ret = 0; out: @@ -254,7 +254,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry) drop_nlink(inode); SetMtimeFlag(parent); - dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); + dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty_sync(dir); } return ret; @@ -331,7 +331,7 @@ static int orangefs_symlink(struct inode *dir, dentry->d_name.name); SetMtimeFlag(parent); - dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); + dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty_sync(dir); ret = 0; out: @@ -399,7 +399,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode * across clients; keep constant at 1. */ SetMtimeFlag(parent); - dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); + dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty_sync(dir); out: op_release(new_op); @@ -443,7 +443,7 @@ static int orangefs_rename(struct inode *old_dir, ret); if (new_dentry->d_inode) - new_dentry->d_inode->i_ctime = CURRENT_TIME; + new_dentry->d_inode->i_ctime = current_time(new_dentry->d_inode); op_release(new_op); return ret; -- cgit v1.2.3