Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 101105b1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 35ff96df 3873691e
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -51,8 +51,6 @@ prototypes:
	int (*rmdir) (struct inode *,struct dentry *);
	int (*rmdir) (struct inode *,struct dentry *);
	int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
	int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
	int (*rename) (struct inode *, struct dentry *,
	int (*rename) (struct inode *, struct dentry *,
			struct inode *, struct dentry *);
	int (*rename2) (struct inode *, struct dentry *,
			struct inode *, struct dentry *, unsigned int);
			struct inode *, struct dentry *, unsigned int);
	int (*readlink) (struct dentry *, char __user *,int);
	int (*readlink) (struct dentry *, char __user *,int);
	const char *(*get_link) (struct dentry *, struct inode *, void **);
	const char *(*get_link) (struct dentry *, struct inode *, void **);
@@ -81,7 +79,6 @@ mkdir: yes
unlink:		yes (both)
unlink:		yes (both)
rmdir:		yes (both)	(see below)
rmdir:		yes (both)	(see below)
rename:	yes (all)	(see below)
rename:	yes (all)	(see below)
rename2:	yes (all)	(see below)
readlink:	no
readlink:	no
get_link:	no
get_link:	no
setattr:	yes
setattr:	yes
@@ -97,8 +94,7 @@ tmpfile: no


	Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
	Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
victim.
victim.
	cross-directory ->rename() and rename2() has (per-superblock)
	cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem.
->s_vfs_rename_sem.


See Documentation/filesystems/directory-locking for more detailed discussion
See Documentation/filesystems/directory-locking for more detailed discussion
of the locking scheme for directory operations.
of the locking scheme for directory operations.
+1 −1
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@ locks victim and calls the method. Locks are exclusive.


4) rename() that is _not_ cross-directory.  Locking rules: caller locks
4) rename() that is _not_ cross-directory.  Locking rules: caller locks
the parent and finds source and target.  In case of exchange (with
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,
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.
lock it.  If we need to lock both, lock them in inode pointer order.
Then call the method.  All locks are exclusive.
Then call the method.  All locks are exclusive.
+4 −0
Original line number Original line Diff line number Diff line
@@ -592,3 +592,7 @@ in your dentry operations instead.
	work just as well; if it's something more complicated, use dentry->d_parent.
	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
	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.
	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.
+2 −7
Original line number Original line Diff line number Diff line
@@ -375,8 +375,6 @@ struct inode_operations {
	int (*rmdir) (struct inode *,struct dentry *);
	int (*rmdir) (struct inode *,struct dentry *);
	int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
	int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
	int (*rename) (struct inode *, struct dentry *,
	int (*rename) (struct inode *, struct dentry *,
			struct inode *, struct dentry *);
	int (*rename2) (struct inode *, struct dentry *,
			struct inode *, struct dentry *, unsigned int);
			struct inode *, struct dentry *, unsigned int);
	int (*readlink) (struct dentry *, char __user *,int);
	int (*readlink) (struct dentry *, char __user *,int);
	const char *(*get_link) (struct dentry *, struct inode *,
	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
  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.
	have the parent and name given by the second inode and dentry.


  rename2: this has an additional flags argument compared to rename.
	The filesystem must return -EINVAL for any unsupported or
	If no flags are supported by the filesystem then this method
	unknown	flags.  Currently the following flags are implemented:
	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:
	(1) RENAME_NOREPLACE: this flag indicates that if the target
	(1) RENAME_NOREPLACE: this flag indicates that if the target
	of the rename exists the rename should fail with -EEXIST
	of the rename exists the rename should fail with -EEXIST
	instead of replacing the target.  The VFS already checks for
	instead of replacing the target.  The VFS already checks for
+1 −1
Original line number Original line Diff line number Diff line
@@ -103,7 +103,7 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
	inode->i_mode = mode;
	inode->i_mode = mode;
	inode->i_uid = current_fsuid();
	inode->i_uid = current_fsuid();
	inode->i_gid = current_fsgid();
	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:
out:
	return inode;
	return inode;
}
}
Loading