fs: introduce inode operation ->update_time
Subsystems (8)
RFC PATCH 1/2 fs: introduce inode operation ->update_time
Btrfs has to make sure we have space to allocate new blocks in order to modify the inode, so updating time can fail. We've gotten around this by having our own file_update_time but this is kind of a pain, and Christoph has indicated he would like to make xfs do something different with atime updates. So introduce ->update_time, where we will deal with i_version an a/m/c time updates and indicate which changes need to be made. The normal version just does what it has always done, updates the time and marks the inode dirty, and then filesystems can choose to do something different.
I've gone through all of the users of file_update_time and made them check for errors with the exception of the fault code since it's complicated and I wasn't quite sure what to do there, also Jan is going to be pushing the file time updates into page_mkwrite for those who have it so that should satisfy btrfs and make it not a big deal to check the file_update_time() return code in the generic fault path. Thanks,
--- Documentation/filesystems/Locking | 3 ++ Documentation/filesystems/vfs.txt | 4 +++ fs/fuse/file.c | 4 ++- fs/inode.c | 50 +++++++++++++++++++++++++++--------- fs/ncpfs/file.c | 6 +++- fs/ntfs/file.c | 4 ++- fs/pipe.c | 7 +++- fs/splice.c | 6 +++- fs/xfs/xfs_file.c | 9 +++++- include/linux/fs.h | 10 ++++++- mm/filemap.c | 4 ++- mm/filemap_xip.c | 4 ++- 12 files changed, 85 insertions(+), 26 deletions(-)
Documentation/filesystems/Locking +3 -0
@@ -62,6 +62,7 @@ ata *); int (*removexattr) (struct dentry *, const char *); void (*truncate_range)(struct inode *, loff_t, loff_t); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); + void (*update_time)(struct inode *, struct timespec *, int); locking rules: all may block
@@ -89,6 +90,8 @@ listxattr: no removexattr: yes truncate_range: yes fiemap: no +update_time: no + Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on victim. cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem.
Documentation/filesystems/vfs.txt +4 -0
@@ -364,6 +364,7 @@ struct inode_operations { ssize_t (*listxattr) (struct dentry *, char *, size_t); int (*removexattr) (struct dentry *, const char *); void (*truncate_range)(struct inode *, loff_t, loff_t); + void (*update_time)(struct inode *, struct timespec *, int); }; Again, all methods are called without any locks being held, unless
@@ -475,6 +476,9 @@ otherwise noted. truncate_range: a method provided by the underlying filesystem to truncate a range of blocks , i.e. punch a hole somewhere in a file. + update_time: called by the VFS to update a specific time or the i_version of + an inode. If this is not defined the VFS will update the inode itself + and call mark_inode_dirty_sync. The Address Space Object ========================
fs/fuse/file.c +3 -1
@@ -960,7 +960,9 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,if (err) goto out; -file_update_time (file); + err =file_update_time (file); +if (err) + goto out;iov_iter_init (&i, iov, nr_segs, count,0 ); written =fuse_perform_write (file, mapping, &i, pos);
fs/inode.c +37 -13
80 lines not on this page · raw message
fs/ncpfs/file.c +4 -2
@@ -222,6 +222,10 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * already_written =0 ; + errno =file_update_time (file); +if (errno) + goto outrel; + bouncebuffer =vmalloc (bufsize);if (!bouncebuffer) { errno = -EIO ;/* -ENOMEM */
@@ -253,8 +257,6 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * }vfree (bouncebuffer); -file_update_time (file); - *ppos = pos;if (pos >i_size_read (inode)) {
fs/ntfs/file.c +3 -1
@@ -2096,7 +2096,9 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb, err =file_remove_suid (file);if (err) goto out; -file_update_time (file); + err =file_update_time (file); +if (err) + goto out; written =ntfs_file_buffered_write (iocb, iov, nr_segs, pos, ppos, count); out:
fs/pipe.c +5 -2
@@ -626,8 +626,11 @@ out:wake_up_interruptible_sync_poll (&pipe->wait,POLLIN |POLLRDNORM );kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN ); } -if (ret >0 ) -file_update_time (filp); +if (ret >0 ) { +int err =file_update_time (filp); +if (err) + ret = err; + }return ret; }
fs/splice.c +4 -2
@@ -1003,8 +1003,10 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,mutex_lock_nested (&inode->i_mutex,I_MUTEX_CHILD ); ret =file_remove_suid (out);if (!ret) { -file_update_time (out); - ret =splice_from_pipe_feed (pipe, &sd, pipe_to_file); + ret =file_update_time (out); +if (!ret) + ret =splice_from_pipe_feed (pipe, &sd, + pipe_to_file); }mutex_unlock (&inode->i_mutex); }while (ret >0 );
fs/xfs/xfs_file.c +7 -2
@@ -659,8 +659,13 @@ restart:return error; } -if (likely (!(file->f_mode &FMODE_NOCMTIME ))) -file_update_time (file); +if (likely (!(file->f_mode &FMODE_NOCMTIME ))) { + error =file_update_time (file); +if (error) { +xfs_rw_iunlock (ip,XFS_ILOCK_EXCL ); +return error; + } + }/* * If the offset is beyond the size of the file, we need to zero any
include/linux/fs.h +9 -1
@@ -1653,6 +1653,7 @@ struct inode_operations {void (*truncate_range)(struct inode *,loff_t ,loff_t );int (*fiemap)(struct inode *,struct fiemap_extent_info *,u64 start,u64 len); +int (*update_time)(struct inode *,struct timespec *,int ); }____cacheline_aligned ;struct seq_file ;
@@ -1811,6 +1812,13 @@ static inline void inode_inc_iversion(struct inode *inode)spin_unlock (&inode->i_lock); } +enum file_time_flags { +S_ATIME =1 , +S_MTIME =2 , +S_CTIME =4 , +S_VERSION =8 , +}; +extern void touch_atime (struct vfsmount *mnt,struct dentry *dentry);static inline void file_accessed (struct file *file) {
@@ -2554,7 +2562,7 @@ extern int inode_change_ok(const struct inode *, struct iattr *);extern int inode_newsize_ok (const struct inode *,loff_t offset);extern void setattr_copy (struct inode *inode,const struct iattr *attr); -extern void file_update_time (struct file *file); +extern int file_update_time (struct file *file);extern int generic_show_options (struct seq_file *m,struct dentry *root);extern void save_mount_options (struct super_block *sb,char *options);
mm/filemap.c +3 -1
@@ -2534,7 +2534,9 @@ ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,if (err) goto out; -file_update_time (file); + err =file_update_time (file); +if (err) + goto out;/* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ if (unlikely (file->f_flags &O_DIRECT )) {
mm/filemap_xip.c +3 -1
@@ -421,7 +421,9 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len,if (ret) goto out_backing; -file_update_time (filp); + ret =file_update_time (filp); +if (ret) + goto out_backing; ret =__xip_file_write (filp, buf, count, pos, ppos);
Signature · 1 line
1.7.5.2
RFC PATCH 2/2 Btrfs: move over to use ->update_time
Btrfs had been doing it's own file_update_time so we could catch ENOSPC properly, so just update our btrfs_update_time to work with the new stuff and then we'll be fancy later. Thanks,
--- fs/btrfs/ctree.h | 1 - fs/btrfs/file.c | 2 +- fs/btrfs/inode.c | 53 ++++++++++++++--------------------------------------- 3 files changed, 15 insertions(+), 41 deletions(-)
fs/btrfs/ctree.h +0 -1
@@ -2887,7 +2887,6 @@ int btrfs_readpage(struct file *file, struct page *page);void btrfs_evict_inode (struct inode *inode);int btrfs_write_inode (struct inode *inode,struct writeback_control *wbc);int btrfs_dirty_inode (struct inode *inode); -int btrfs_update_time (struct file *file);struct inode *btrfs_alloc_inode (struct super_block *sb);void btrfs_destroy_inode (struct inode *inode);int btrfs_drop_inode (struct inode *inode);
fs/btrfs/file.c +1 -1
@@ -1389,7 +1389,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, goto out; } - err =btrfs_update_time (file); + err =file_update_time (file);if (err) {mutex_unlock (&inode->i_mutex); goto out;
fs/btrfs/inode.c +14 -39
85 lines not on this page · raw message
Signature · 1 line
1.7.5.2
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Hello,
Mimi and I working on IMA/EVM (security/integrity) and it uses i_version for checking if file content has been changed. extX file systems support i_version updates with mounting file system with "iversion" option or via kernel command line parameter "i_version"
It seems iversion option is not recognized when mounting btrfs. I see this patchset deals with i_version update as well.. Can you please give an advice how to use i_version with btrfs?
Thanks,
Dmitry
Quoted 1 line · Josef Bacik
Btrfs had been doing it's own
file_update_timeso we could catch ENOS=
PC
Quoted 1 line
properly, so just update our
btrfs_update_timeto work with the new s=
tuff and
Quoted 7 lines
then we'll be fancy later. =C2=A0Thanks,
Signed-off-by Josef Bacik <[email protected]>---
=C2=A0fs/btrfs/ctree.h | =C2=A0 =C2=A01 - =C2=A0fs/btrfs/file.c =C2=A0| =C2=A0 =C2=A02 +- =C2=A0fs/btrfs/inode.c | =C2=A0 53 ++++++++++++++--------------------=
-------------------
fs/btrfs/ctree.h int btrfs_readpage(struct file *file, struct pa=
Quoted 7 lines
=C2=A03 files changed, 15 insertions(+), 41 deletions(-)
fs/btrfs/ctree.h +0
-0@@ -2887,7 +2887,6 @@ int btrfs_readpage(struct file *file, struct pa=
ge *page);
Quoted 2 lines
fs/btrfs/ctree.h +0
-0=C2=A0void btrfs_evict_inode(struct inode *inode);=C2=A0int btrfs_write_inode(struct inode *inode, struct writeback_con=
trol *wbc);
fs/btrfs/file.c static ssize_t btrfs_file_aio_write(struct kioc=
Quoted 10 lines
=C2=A0int
btrfs_dirty_inode(struct inode *inode); -intbtrfs_update_time(struct file *file); =C2=A0struct inode *btrfs_alloc_inode(structsuper_block*sb); =C2=A0voidbtrfs_destroy_inode(struct inode *inode); =C2=A0intbtrfs_drop_inode(struct inode *inode);fs/btrfs/file.c +0
-0@@ -1389,7 +1389,7 @@ static ssize_t btrfs_file_aio_write(struct kioc=
b *iocb,
Quoted 7 lines
fs/btrfs/file.c +1
-1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out; =C2=A0 =C2=A0 =C2=A0 =C2=A0} - =C2=A0 =C2=A0 =C2=A0 err =3D btrfs_update_time(file); + =C2=A0 =C2=A0 =C2=A0 err =3D file_update_time(file); =C2=A0 =C2=A0 =C2=A0 =C2=A0if (err) {=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mutex_unlock(&=
inode->i_mutex);
Quoted 7 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;
fs/btrfs/inode.c +0
-0@@ -4287,46 +4287,18 @@ int btrfs_dirty_inode(struct inode *inode)=C2=A0* This is a copy of
file_update_time. =C2=A0We need this so we =
can return error on
Quoted 1 line
=C2=A0* ENOSPC for updating the inode in the case of file write and m=
map writes.
fs/btrfs/inode.c
Quoted 3 lines
=C2=A0*/
fs/btrfs/inode.c +1
-1-int btrfs_update_time (struct file *file) +static int btrfs_update_time(struct inode *inode, struct timespec *n=
ow,
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0int flags)
Quoted 2 lines
=C2=A0{
- =C2=A0 =C2=A0 =C2=A0 struct inode *inode =3D file->f_path.dentry->d=
_inode;
Quoted 3 lines
- =C2=A0 =C2=A0 =C2=A0 struct timespec now;
- =C2=A0 =C2=A0 =C2=A0 int ret;
- =C2=A0 =C2=A0 =C2=A0 enum {S_MTIME=3D 1,S_CTIME=3D 2, S_VERSION=
=3D 4 } sync_it =3D 0;
Quoted 2 lines
-
- =C2=A0 =C2=A0 =C2=A0 /* First try to exhaust all avenues to not syn=
c */
Quoted 6 lines
- =C2=A0 =C2=A0 =C2=A0 if (
IS_NOCMTIME(inode))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0; -
- =C2=A0 =C2=A0 =C2=A0 now =3Dcurrent_fs_time(inode->i_sb);
- =C2=A0 =C2=A0 =C2=A0 if (!timespec_equal(&inode->i_mtime, &now))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sync_it=3D S_MTIM=
E;
Quoted 3 lines
-
- =C2=A0 =C2=A0 =C2=A0 if (!timespec_equal(&inode->i_ctime, &now))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sync_it|=3D S_CTI=
ME;
Quoted 3 lines
-
- =C2=A0 =C2=A0 =C2=A0 if (IS_I_VERSION(inode))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sync_it|=3D S_VER=
SION;
Quoted 11 lines
fs/btrfs/inode.c +1
-10- - =C2=A0 =C2=A0 =C2=A0 if (!sync_it) - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0; - - =C2=A0 =C2=A0 =C2=A0 /* Finally allowed to write? Takes lock. */ - =C2=A0 =C2=A0 =C2=A0 if (mnt_want_write_file(file)) - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0; - - =C2=A0 =C2=A0 =C2=A0 /* Only change inode inside the lock region */ - =C2=A0 =C2=A0 =C2=A0 if (sync_it & S_VERSION) + =C2=A0 =C2=A0 =C2=A0 if (flags & S_VERSION)
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inode_inc_iver=
sion(inode);
Quoted 2 lines
- =C2=A0 =C2=A0 =C2=A0 if (
sync_it&S_CTIME)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inode->i_ctime=3D=
now;
Quoted 2 lines
- =C2=A0 =C2=A0 =C2=A0 if (
sync_it&S_MTIME)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inode->i_mtime=3D=
now;
Quoted 3 lines
- =C2=A0 =C2=A0 =C2=A0 ret =3D
btrfs_dirty_inode(inode);
- =C2=A0 =C2=A0 =C2=A0 if (!ret)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mark_inode_dirty_s=
ync(inode);
Quoted 4 lines
- =C2=A0 =C2=A0 =C2=A0
mnt_drop_write(file->f_path.mnt);
- =C2=A0 =C2=A0 =C2=A0 return ret;
+ =C2=A0 =C2=A0 =C2=A0 if (flags &S_CTIME)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inode->i_ctime=3D=
*now;
Quoted 2 lines
+ =C2=A0 =C2=A0 =C2=A0 if (flags &
S_MTIME)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inode->i_mtime=3D=
*now;
Quoted 2 lines
+ =C2=A0 =C2=A0 =C2=A0 if (flags &
S_ATIME)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inode->i_atime=3D=
*now;
fs/btrfs/inode.c int btrfs_page_mkwrite(struct vm_area_struct *v=
Quoted 5 lines
+ =C2=A0 =C2=A0 =C2=A0 return
btrfs_dirty_inode(inode); =C2=A0}=C2=A0/*
fs/btrfs/inode.c +0
-0@@ -6405,7 +6377,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *v=
ma, struct vm_fault *vmf)
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0ret =C2=A0=3D btrfs_delalloc_reserve_space=
(inode, PAGE_CACHE_SIZE);
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!ret)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D btrfs_upda=
te_time(vma->vm_file);
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D file_updat=
e_time(vma->vm_file);
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret =3D=3D=
-ENOMEM)
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0ret =3D VM_FAULT_OOM;
fs/btrfs/inode.c static const struct inode_operations btrfs_file=
Quoted 1 line
fs/btrfs/inode.c +0
-0@@ -7451,6 +7423,7 @@ static const struct inode_operations btrfs_file=
_inode_operations =3D {
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.permission =C2=A0 =C2=A0 =3D btrfs_permis=
sion,
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.fiemap =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D bt=
rfs_fiemap,
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.get_acl =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D bt=
rfs_get_acl,
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 .update_time =C2=A0 =C2=A0=3D btrfs_update_tim=
e,
Quoted 2 lines
=C2=A0};
=C2=A0static const structinode_operationsbtrfs_special_inode_operat=
ions =3D {
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.getattr =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D bt=
rfs_getattr,
fs/btrfs/inode.c static const struct inode_operations btrfs_spec=
Quoted 1 line
fs/btrfs/inode.c +0
-0@@ -7461,6 +7434,7 @@ static const struct inode_operations btrfs_spec=
ial_inode_operations =3D {
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.listxattr =C2=A0 =C2=A0 =C2=A0=3D btrfs_l=
istxattr,
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.removexattr =C2=A0 =C2=A0=3D btrfs_remove=
xattr,
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.get_acl =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D bt=
rfs_get_acl,
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 .update_time =C2=A0 =C2=A0=3D btrfs_update_tim=
e,
Quoted 2 lines
=C2=A0};
=C2=A0static const structinode_operationsbtrfs_symlink_inode_operat=
ions =3D {
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.readlink =C2=A0 =C2=A0 =C2=A0 =3D generic=
_readlink,
fs/btrfs/inode.c static const struct inode_operations btrfs_syml=
Quoted 1 line
fs/btrfs/inode.c +0
-0@@ -7474,6 +7448,7 @@ static const struct inode_operations btrfs_syml=
ink_inode_operations =3D {
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.listxattr =C2=A0 =C2=A0 =C2=A0=3D btrfs_l=
istxattr,
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.removexattr =C2=A0 =C2=A0=3D btrfs_remove=
xattr,
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0.get_acl =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D bt=
rfs_get_acl,
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 .update_time =C2=A0 =C2=A0=3D btrfs_update_tim=
e,
Quoted 8 lines
=C2=A0};
=C2=A0const struct
dentry_operationsbtrfs_dentry_operations=3D { --
1.7.5.2--
To unsubscribe from this list: send the line "unsubscribe linux-fsdev=
el" in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.ht=
ml
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 8 lines · Dmitry
Hello,
Mimi and I working on IMA/EVM (
security/integrity) and it usesi_versionfor checking if file content has been changed. extX file systems supporti_versionupdates with mounting file system with "iversion" option or via kernel command line parameter "i_version"
Quoted 4 lines
It seems iversion option is not recognized when mounting btrfs. I see this patchset deals with
i_versionupdate as well.. Can you please give an advice how to usei_versionwith btrfs?
Oh good somebody uses this? We actually have a ->sequence thing we use for this, the grand idea was to make it smarter about telling nfs when something changed, but if you guys use i_version we could probably get rid of our in-core sequence and use the normal inodes i_version and then just store it in our sequence field on disk. I'll do it without a mount option tho so it just works, does that sound good to you? Thanks,
Josef
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 14 lines · Josef Bacik
Quoted 8 lines · Dmitry
Hello,
Mimi and I working on IMA/EVM (
security/integrity) and it usesi_versionfor checking if file content has been changed. extX file systems supporti_versionupdates with mounting file system with "iversion" option or via kernel command line parameter "i_version"Quoted 4 lines
It seems iversion option is not recognized when mounting btrfs. I see this patchset deals with
i_versionupdate as well.. Can you please give an advice how to usei_versionwith btrfs?
Quoted 8 lines
Oh good somebody uses this? We actually have a ->sequence thing we use for this, the grand idea was to make it smarter about telling nfs when something changed, but if you guys use
i_versionwe could probably get rid of our in-core sequence and use the normal inodesi_versionand then just store it in our sequence field on disk. I'll do it without a mount option tho so it just works, does that sound good to you? Thanks,Josef
Sounds really good!
thanks,
Mimi
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
On Wed, Apr 4, 2012 at 8:47 PM, Mimi Zohar <[email protected]> w= rote:
Quoted 7 lines · Josef Bacik
Quoted 6 lines · Dmitry
Quoted 5 lines
Hello,
Mimi and I working on IMA/EVM (
security/integrity) and it usesi_versionfor checking if file content has been changed. extX file systems supporti_versionupdates with mounting file sys=
tem
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
with "iversion" option or via kernel command line parameter "
i_version"It seems iversion option is not recognized when mounting btrfs. I see this patchset deals with
i_versionupdate as well.. Can you please give an advice how to usei_versionwith btrfs?Oh good somebody uses this? =C2=A0We actually have a ->sequence thin=
g we use for
Quoted 1 line
Quoted 1 line
this, the grand idea was to make it smarter about telling nfs when s=
omething
Quoted 1 line
Quoted 1 line
changed, but if you guys use
i_versionwe could probably get rid of =
our in-core
Quoted 1 line
Quoted 1 line
sequence and use the normal inodes
i_versionand then just store it =
in our
Quoted 1 line
Quoted 1 line
sequence field on disk. =C2=A0I'll do it without a mount option tho =
so it just works,
Quoted 1 line
Quoted 1 line
does that sound good to you? =C2=A0Thanks,
Hello,
Thank you for the answer...
But can you a bit clarify...
Looking to file_update_time() I see that it does:
if (IS_I_VERSION(inode)) sync_it |=3D S_VERSION;
Basically it should be (inode->i_sb->s_flags & MS_I_VERSION)
use of i_version is controlled by iversion mount flag. for ext4 I see in parse_options():
case Opt_i_version: set_opt(sb, I_VERSION); sb->s_flags |=3D MS_I_VERSION; break;
But who sets MS_I_VERSION in s_flags on btrfs?
Thanks.
- Dmitry
Quoted 9 lines
Quoted 2 lines
Josef
Sounds really good!
thanks,
Mimi
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 1 line · Dmitry
On Wed, Apr 4, 2012 at 8:47 PM, Mimi Zohar <[email protected]>=
Quoted 7 lines · wrote:
Quoted 7 lines · Josef Bacik
Quoted 6 lines · Dmitry
Quoted 5 lines
Hello,
Mimi and I working on IMA/EVM (
security/integrity) and it usesi_versionfor checking if file content has been changed. extX file systems supporti_versionupdates with mounting file s=
ystem
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
with "iversion" option or via kernel command line parameter "
i_version"It seems iversion option is not recognized when mounting btrfs. I see this patchset deals with
i_versionupdate as well.. Can you please give an advice how to usei_versionwith btrfs?Oh good somebody uses this? =A0We actually have a ->sequence thing=
we use for
Quoted 1 line
Quoted 1 line
Quoted 1 line
this, the grand idea was to make it smarter about telling nfs when=
something
Quoted 1 line
Quoted 1 line
Quoted 1 line
changed, but if you guys use
i_versionwe could probably get rid o=
f our in-core
Quoted 1 line
Quoted 1 line
Quoted 1 line
sequence and use the normal inodes
i_versionand then just store i=
t in our
Quoted 1 line
Quoted 1 line
Quoted 1 line
sequence field on disk. =A0I'll do it without a mount option tho s=
o it just works,
Quoted 17 lines
Quoted 1 line
Quoted 1 line
does that sound good to you? =A0Thanks,
=20
Hello,
=20
Thank you for the answer...
But can you a bit clarify...
=20
Looking tofile_update_time()I see that it does:
=20if (IS_I_VERSION(inode)) sync_it |=3D S_VERSION;=20
Basically it should be (inode->i_sb->s_flags&MS_I_VERSION) =20
use ofi_versionis controlled by iversion mount flag. for ext4 I see inparse_options():
=20
Quoted 8 lines
case Opt_i_version: set_opt(sb, I_VERSION); sb->s_flags |=3D MS_I_VERSION; break;=20
=20
But who setsMS_I_VERSIONins_flagson btrfs?
=20
Nobody yet, I'm going to send a patch shortly that will support this. = Thanks,
Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 10 lines · Josef Bacik
Quoted 1 line · Dmitry
On Wed, Apr 4, 2012 at 8:47 PM, Mimi Zohar <[email protected]=
Quoted 7 lines · wrote:
Quoted 7 lines · Josef Bacik
Quoted 6 lines · Dmitry
Quoted 5 lines
Hello,
Mimi and I working on IMA/EVM (
security/integrity) and it usesi_versionfor checking if file content has been changed. extX file systems supporti_versionupdates with mounting file =
system
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
with "iversion" option or via kernel command line parameter "
i_version"It seems iversion option is not recognized when mounting btrfs. I see this patchset deals with
i_versionupdate as well.. Can you please give an advice how to usei_versionwith btrfs?Oh good somebody uses this? =C2=A0We actually have a ->sequence t=
hing we use for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
this, the grand idea was to make it smarter about telling nfs whe=
n something
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
changed, but if you guys use
i_versionwe could probably get rid =
of our in-core
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
sequence and use the normal inodes
i_versionand then just store =
it in our
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
sequence field on disk. =C2=A0I'll do it without a mount option t=
ho so it just works,
Quoted 11 lines
Quoted 11 lines
Quoted 1 line
Quoted 1 line
does that sound good to you? =C2=A0Thanks,
Hello,
Thank you for the answer...
But can you a bit clarify...Looking to
file_update_time()I see that it does:=C2=A0 =C2=A0 =C2=A0 if (
IS_I_VERSION(inode))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sync_it|=3D S_VERS=
ION;
Quoted 8 lines
Quoted 8 lines
Basically it should be (
inode->i_sb->s_flags&MS_I_VERSION)use of
i_versionis controlled by iversion mount flag. for ext4 I see inparse_options():=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 case
Opt_i_version:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 set_opt(sb, I_VERSION);
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 sb->s_flags |=3D MS_I_VERSION;
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 break;
Quoted 6 lines
Quoted 4 lines
But who sets
MS_I_VERSIONins_flagson btrfs?Nobody yet, I'm going to send a patch shortly that will support this.=
=C2=A0Thanks,
Quoted 2 lines
Josef
Great. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
In reply to Josef BacikQuoted 2 lines · Josef Bacik
Quoted 1 line · Dmitry
On Wed, Apr 4, 2012 at 8:47 PM, Mimi Zohar <[email protected]=
Quoted 2 lines · m> wrote:
Quoted 2 lines
Quoted 2 lines · Josef Bacik
Quoted 1 line
On Wed, Apr 04, 2012 at 08:24:19PM +0300, Kasatkin, Dmitry wrote=
:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Hello,
Mimi and I working on IMA/EVM (
security/integrity) and it usesi_versionfor checking if file content has been changed. extX file systems supporti_versionupdates with mounting file=
system
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
with "iversion" option or via kernel command line parameter "
i_version"It seems iversion option is not recognized when mounting btrfs=
=2E
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
I see this patchset deals with
i_versionupdate as well.. Can you please give an advice how to usei_versionwith btrfs?Oh good somebody uses this? =C2=A0We actually have a ->sequence =
thing we use for
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
this, the grand idea was to make it smarter about telling nfs wh=
en something
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
changed, but if you guys use
i_versionwe could probably get rid=
of our in-core
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
sequence and use the normal inodes
i_versionand then just store=
it in our
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
sequence field on disk. =C2=A0I'll do it without a mount option =
tho so it just works,
Quoted 25 lines
Quoted 17 lines
Quoted 1 line
Quoted 1 line
does that sound good to you? =C2=A0Thanks,
=20
Hello,
=20
Thank you for the answer...
But can you a bit clarify...
=20
Looking tofile_update_time()I see that it does:
=20if (IS_I_VERSION(inode)) sync_it |=3D S_VERSION;=20
Basically it should be (inode->i_sb->s_flags&MS_I_VERSION) =20
use ofi_versionis controlled by iversion mount flag. for ext4 I see inparse_options():
=20Quoted 8 lines
case Opt_i_version: set_opt(sb, I_VERSION); sb->s_flags |=3D MS_I_VERSION; break;=20
=20
But who setsMS_I_VERSIONins_flagson btrfs?
=20
Quoted 2 lines
=20
Nobody yet, I'm going to send a patch shortly that will support this.=
Thanks,
Great. It would also be far preferable if it was just always on (at least by default) rather than requiring a mount option.
--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 4 lines · J. Bruce Fields
Quoted 1 line
Nobody yet, I'm going to send a patch shortly that will support this. Thanks,
Great. It would also be far preferable if it was just always on (at least by default) rather than requiring a mount option.
[looks into Josef's patch] it is, no mount option needed.
david
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 2 lines · David Sterba
Quoted 1 line · J. Bruce Fields
Quoted 1 line
Nobody yet, I'm going to send a patch shortly that will support th=
is. =C2=A0Thanks,
Quoted 2 lines
Quoted 2 lines
Great. =C2=A0It would also be far preferable if it was just always o=
n (at
Quoted 4 lines
Quoted 1 line
least by default) rather than requiring a mount option.
[looks into Josef's patch] it is, no mount option needed.
Where is it? Can you please point out?
Thanks.
Quoted 2 lines
david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 1 line · Dmitry
Where is it? Can you please point out?
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/16662
the relevant part:
-- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -770,7 +770,7 @@ static int btrfs_fill_super(struct super_block *sb,
#ifdef CONFIG_BTRFS_FS_POSIX_ACL
sb->s_flags |= MS_POSIXACL;
#endif
-
+ sb->s_flags |= MS_I_VERSION;
err = open_ctree(sb, fs_devices, (char *)data);
if (err) {
printk("btrfs: open_ctree failed\n");
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Review static int btrfs_fill_super(struct super_block *s=
Quoted 10 lines · David Sterba
Quoted 1 line · Dmitry
Where is it? Can you please point out?
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/16662
the relevant part:
--
a/fs/btrfs/super.c
+++b/fs/btrfs/super.c(quoted diff) +0
-0@@ -770,7 +770,7 @@ static int btrfs_fill_super(struct super_block *s=
b,
Quoted 6 lines
=C2=A0#ifdef
CONFIG_BTRFS_FS_POSIX_ACL
=C2=A0 =C2=A0 =C2=A0 =C2=A0sb->s_flags |=3DMS_POSIXACL; =C2=A0#endif
-
+ =C2=A0 =C2=A0 =C2=A0sb->s_flags|=3DMS_I_VERSION; =C2=A0 =C2=A0 =C2=A0 =C2=A0err =3D open_ctree(sb,fs_devices, (char *=
)data);
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0if (err) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printk("btrfs:=
open_ctree failed\n");
=46antastic.. I see...
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Josef Bacik
Btrfs has to make sure we have space to allocate new blocks in order to modify the inode, so updating time can fail. We've gotten around this by having our own
file_update_timebut this is kind of a pain, and Christoph has indicated he would like to make xfs do something different with atime updates. So introduce ->update_time, where we will deal withi_versionan a/m/c time updates and indicate which changes need to be made. The normal version just does what it has always done, updates the time and marks the inode dirty, and then filesystems can choose to do something different.
Quoted 6 lines
I've gone through all of the users of
file_update_timeand made them check for errors with the exception of the fault code since it's complicated and I wasn't quite sure what to do there, also Jan is going to be pushing the file time updates intopage_mkwritefor those who have it so that should satisfy btrfs and make it not a big deal to check thefile_update_time()return code in the generic fault path. Thanks,
Any reason that atime updates ignore the return value?
Otherwise looks fine,
Quoted 17 lines · Christoph Hellwig
Quoted 9 lines · Josef Bacik
Btrfs has to make sure we have space to allocate new blocks in order to modify the inode, so updating time can fail. We've gotten around this by having our own
file_update_timebut this is kind of a pain, and Christoph has indicated he would like to make xfs do something different with atime updates. So introduce ->update_time, where we will deal withi_versionan a/m/c time updates and indicate which changes need to be made. The normal version just does what it has always done, updates the time and marks the inode dirty, and then filesystems can choose to do something different.Quoted 6 lines
I've gone through all of the users of
file_update_timeand made them check for errors with the exception of the fault code since it's complicated and I wasn't quite sure what to do there, also Jan is going to be pushing the file time updates intopage_mkwritefor those who have it so that should satisfy btrfs and make it not a big deal to check thefile_update_time()return code in the generic fault path. Thanks,
Quoted 4 lines
Any reason that atime updates ignore the return value?
Otherwise looks fine,
Yeah I figure it's not nice to return ENOSPC when somebody is doing a lookup, I'm open to other suggestions, but btrfs especially hits this with some of the ENOSPC xfstests and I think that could lead to unhappy users. Thanks,
Josef
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
In reply to David SterbaReview static int btrfs_fill_super(struct super_block *s=
Quoted 10 lines · David Sterba
Quoted 1 line · Dmitry
Where is it? Can you please point out?
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/16662
the relevant part:
--
a/fs/btrfs/super.c
+++b/fs/btrfs/super.c(quoted diff) +0
-0@@ -770,7 +770,7 @@ static int btrfs_fill_super(struct super_block *s=
b,
Quoted 6 lines
=C2=A0#ifdef
CONFIG_BTRFS_FS_POSIX_ACL
=C2=A0 =C2=A0 =C2=A0 =C2=A0sb->s_flags |=3DMS_POSIXACL; =C2=A0#endif
-
+ =C2=A0 =C2=A0 =C2=A0sb->s_flags|=3DMS_I_VERSION; =C2=A0 =C2=A0 =C2=A0 =C2=A0err =3D open_ctree(sb,fs_devices, (char *=
)data);
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0if (err) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printk("btrfs:=
open_ctree failed\n");
Hello,
=46YI:
In fact just tried yesterday to use mount option "iversion" on 3.4-rc5 and it seems to work without
+ =C2=A0 =C2=A0 =C2=A0 sb->s_flags |=3D MS_I_VERSION;
I checked that following is really happening in btrfs_update_time():
if (sync_it & S_VERSION) inode_inc_iversion(inode);
I also put some prints to btrfs_mount and remount and see that MS_I_VERSION is not set there yet.
Somehow magically it gets set...
- Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC] [PATCH 2/2] Btrfs: move over to use ->update_time
Quoted 11 lines · Dmitry
Review static int btrfs_fill_super(struct super_block =
Quoted 10 lines · David Sterba
Quoted 1 line · Dmitry
Where is it? Can you please point out?
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/16662
the relevant part:
--
a/fs/btrfs/super.c
+++b/fs/btrfs/super.c(quoted diff) +0
-0@@ -770,7 +770,7 @@ static int btrfs_fill_super(struct super_block =
*sb,
Quoted 8 lines
Quoted 8 lines
=A0#ifdef
CONFIG_BTRFS_FS_POSIX_ACL
=A0 =A0 =A0 =A0sb->s_flags |=3DMS_POSIXACL;
=A0#endif
-
+ =A0 =A0 =A0sb->s_flags|=3DMS_I_VERSION;
=A0 =A0 =A0 =A0err =3Dopen_ctree(sb, fs_devices, (char *)data); =A0 =A0 =A0 =A0if (err) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printk("btrfs:open_ctreefailed\n")=
;
Quoted 6 lines
=20
Hello,
=20
FYI:
=20
In fact just tried yesterday to use mount option "iversion" on 3.4-rc=
5
Quoted 2 lines
and it seems to work without
+ =A0 =A0 =A0sb->s_flags|=3DMS_I_VERSION;
This hasn't gone in yet, it won't go in until 3.5. Thanks,
Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html