You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro: ">rename2() work from Miklos + current_time() from Deepa" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: Replace current_fs_time() with current_time() fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps fs: Replace CURRENT_TIME with current_time() for inode timestamps fs: proc: Delete inode time initializations in proc_alloc_inode() vfs: Add current_time() api vfs: add note about i_op->rename changes to porting fs: rename "rename2" i_op to "rename" vfs: remove unused i_op->rename fs: make remaining filesystems use .rename2 libfs: support RENAME_NOREPLACE in simple_rename() fs: support RENAME_NOREPLACE for local filesystems ncpfs: fix unused variable warning
This commit is contained in:
@@ -51,8 +51,6 @@ prototypes:
|
||||
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);
|
||||
const char *(*get_link) (struct dentry *, struct inode *, void **);
|
||||
@@ -81,7 +79,6 @@ 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
|
||||
setattr: yes
|
||||
@@ -97,8 +94,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 ->rename() has (per-superblock) ->s_vfs_rename_sem.
|
||||
|
||||
See Documentation/filesystems/directory-locking for more detailed discussion
|
||||
of the locking scheme for directory operations.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -375,8 +375,6 @@ struct inode_operations {
|
||||
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);
|
||||
const char *(*get_link) (struct dentry *, struct inode *,
|
||||
@@ -442,11 +440,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
|
||||
|
||||
@@ -103,7 +103,7 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
|
||||
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);
|
||||
out:
|
||||
return inode;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ static void hypfs_update_update(struct super_block *sb)
|
||||
struct inode *inode = d_inode(sb_info->update_file);
|
||||
|
||||
sb_info->last_update = get_seconds();
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
}
|
||||
|
||||
/* directory tree removal functions */
|
||||
@@ -99,7 +99,7 @@ static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
|
||||
ret->i_mode = mode;
|
||||
ret->i_uid = hypfs_info->uid;
|
||||
ret->i_gid = hypfs_info->gid;
|
||||
ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
|
||||
ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
|
||||
if (S_ISDIR(mode))
|
||||
set_nlink(ret, 2);
|
||||
}
|
||||
|
||||
@@ -934,7 +934,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
|
||||
|
||||
if (ret > 0) {
|
||||
struct inode *inode = file_inode(file);
|
||||
inode->i_atime = current_fs_time(inode->i_sb);
|
||||
inode->i_atime = current_time(inode);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -64,7 +64,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry,
|
||||
inode->i_uid = GLOBAL_ROOT_UID;
|
||||
inode->i_gid = GLOBAL_ROOT_GID;
|
||||
inode->i_blocks = 0;
|
||||
inode->i_atime = CURRENT_TIME;
|
||||
inode->i_atime = current_time(inode);
|
||||
inode->i_mtime = inode->i_atime;
|
||||
inode->i_ctime = inode->i_atime;
|
||||
inode->i_private = data;
|
||||
|
||||
@@ -144,7 +144,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
|
||||
if (ret) {
|
||||
ret->i_ino = get_next_ino();
|
||||
ret->i_mode = mode;
|
||||
ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
|
||||
ret->i_atime = ret->i_mtime = ret->i_ctime = current_time(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
|
||||
if (inode) {
|
||||
inode->i_ino = get_next_ino();
|
||||
inode->i_mode = mode;
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||
}
|
||||
return inode;
|
||||
}
|
||||
|
||||
@@ -4116,7 +4116,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
|
||||
|
||||
if (ret > 0) {
|
||||
struct inode *inode = file_inode(file);
|
||||
inode->i_atime = current_fs_time(inode->i_sb);
|
||||
inode->i_atime = current_time(inode);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1097,13 +1097,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,
|
||||
|
||||
@@ -2409,21 +2409,21 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
|
||||
snoop(&dev->dev, "%s: CONTROL\n", __func__);
|
||||
ret = proc_control(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
case USBDEVFS_BULK:
|
||||
snoop(&dev->dev, "%s: BULK\n", __func__);
|
||||
ret = proc_bulk(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
case USBDEVFS_RESETEP:
|
||||
snoop(&dev->dev, "%s: RESETEP\n", __func__);
|
||||
ret = proc_resetep(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
case USBDEVFS_RESET:
|
||||
@@ -2435,7 +2435,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
|
||||
snoop(&dev->dev, "%s: CLEAR_HALT\n", __func__);
|
||||
ret = proc_clearhalt(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
case USBDEVFS_GETDRIVER:
|
||||
@@ -2462,7 +2462,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
|
||||
snoop(&dev->dev, "%s: SUBMITURB\n", __func__);
|
||||
ret = proc_submiturb(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
@@ -2470,14 +2470,14 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
|
||||
snoop(&dev->dev, "%s: CONTROL32\n", __func__);
|
||||
ret = proc_control_compat(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
case USBDEVFS_BULK32:
|
||||
snoop(&dev->dev, "%s: BULK32\n", __func__);
|
||||
ret = proc_bulk_compat(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
case USBDEVFS_DISCSIGNAL32:
|
||||
@@ -2489,7 +2489,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
|
||||
snoop(&dev->dev, "%s: SUBMITURB32\n", __func__);
|
||||
ret = proc_submiturb_compat(ps, p);
|
||||
if (ret >= 0)
|
||||
inode->i_mtime = CURRENT_TIME;
|
||||
inode->i_mtime = current_time(inode);
|
||||
break;
|
||||
|
||||
case USBDEVFS_IOCTL32:
|
||||
@@ -2552,7 +2552,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
|
||||
done:
|
||||
usb_unlock_device(dev);
|
||||
if (ret >= 0)
|
||||
inode->i_atime = CURRENT_TIME;
|
||||
inode->i_atime = current_time(inode);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1196,15 +1196,15 @@ ffs_sb_make_inode(struct super_block *sb, void *data,
|
||||
inode = new_inode(sb);
|
||||
|
||||
if (likely(inode)) {
|
||||
struct timespec current_time = CURRENT_TIME;
|
||||
struct timespec ts = current_time(inode);
|
||||
|
||||
inode->i_ino = get_next_ino();
|
||||
inode->i_mode = perms->mode;
|
||||
inode->i_uid = perms->uid;
|
||||
inode->i_gid = perms->gid;
|
||||
inode->i_atime = current_time;
|
||||
inode->i_mtime = current_time;
|
||||
inode->i_ctime = current_time;
|
||||
inode->i_atime = ts;
|
||||
inode->i_mtime = ts;
|
||||
inode->i_ctime = ts;
|
||||
inode->i_private = data;
|
||||
if (fops)
|
||||
inode->i_fop = fops;
|
||||
|
||||
@@ -1913,7 +1913,7 @@ gadgetfs_make_inode (struct super_block *sb,
|
||||
inode->i_uid = make_kuid(&init_user_ns, default_uid);
|
||||
inode->i_gid = make_kgid(&init_user_ns, default_gid);
|
||||
inode->i_atime = inode->i_mtime = inode->i_ctime
|
||||
= CURRENT_TIME;
|
||||
= current_time(inode);
|
||||
inode->i_private = data;
|
||||
inode->i_fop = fops;
|
||||
}
|
||||
|
||||
+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);
|
||||
|
||||
+6
-2
@@ -276,7 +276,7 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
|
||||
inode_init_owner(inode, NULL, mode);
|
||||
inode->i_blocks = 0;
|
||||
inode->i_rdev = rdev;
|
||||
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_mapping->a_ops = &v9fs_addr_operations;
|
||||
|
||||
switch (mode & S_IFMT) {
|
||||
@@ -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);
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ adfs_adfs2unix_time(struct timespec *tv, struct inode *inode)
|
||||
return;
|
||||
|
||||
cur_time:
|
||||
*tv = CURRENT_TIME;
|
||||
*tv = current_time(inode);
|
||||
return;
|
||||
|
||||
too_early:
|
||||
|
||||
+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 */
|
||||
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
|
||||
mark_buffer_dirty_inode(dir_bh, dir);
|
||||
affs_brelse(dir_bh);
|
||||
|
||||
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
|
||||
dir->i_mtime = dir->i_ctime = current_time(dir);
|
||||
dir->i_version++;
|
||||
mark_inode_dirty(dir);
|
||||
|
||||
@@ -112,7 +112,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
|
||||
|
||||
affs_brelse(bh);
|
||||
|
||||
dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
|
||||
dir->i_mtime = dir->i_ctime = current_time(dir);
|
||||
dir->i_version++;
|
||||
mark_inode_dirty(dir);
|
||||
|
||||
@@ -313,7 +313,7 @@ affs_remove_header(struct dentry *dentry)
|
||||
else
|
||||
clear_nlink(inode);
|
||||
affs_unlock_link(inode);
|
||||
inode->i_ctime = CURRENT_TIME_SEC;
|
||||
inode->i_ctime = current_time(inode);
|
||||
mark_inode_dirty(inode);
|
||||
|
||||
done:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user