aufs6: adapt to v6.6 i_op->ctime changes

The following commits in 6.6+ change the way i_nodes and ctime are
handled. We adapt the code to match:

 541d4c798a [fs: drop the timespec64 arg from generic_update_time]
 3e32715496 [vfs: get rid of old '->iterate' directory operation]
 0d72b92883 [fs: pass the request_mask to generic_fillattr]
 913e99287b [fs: drop the timespec64 argument from update_time]

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Bruce Ashfield 2023-09-21 22:18:30 -04:00
parent c4342d979b
commit 5883fc3400
5 changed files with 17 additions and 14 deletions

View File

@ -1169,7 +1169,7 @@ static void au_refresh_iattr(struct inode *inode, struct kstat *st,
inode->i_gid = st->gid;
inode->i_atime = st->atime;
inode->i_mtime = st->mtime;
inode->i_ctime = st->ctime;
inode_set_ctime_to_ts( inode, st->ctime );
au_cpup_attr_nlink(inode, /*force*/0);
if (S_ISDIR(inode->i_mode)) {
@ -1306,7 +1306,7 @@ static int aufs_getattr(struct mnt_idmap *idmap, const struct path *path,
goto out_di;
out_fill:
generic_fillattr(idmap, inode, st);
generic_fillattr(idmap, request, inode, st);
out_di:
di_read_unlock(dentry, AuLock_IR);
out_si:
@ -1388,8 +1388,7 @@ static int au_is_special(struct inode *inode)
return (inode->i_mode & (S_IFBLK | S_IFCHR | S_IFIFO | S_IFSOCK));
}
static int aufs_update_time(struct inode *inode, struct timespec64 *ts,
int flags)
static int aufs_update_time(struct inode *inode, int flags)
{
int err;
aufs_bindex_t bindex;
@ -1413,7 +1412,7 @@ static int aufs_update_time(struct inode *inode, struct timespec64 *ts,
h_mnt = au_sbr_mnt(sb, bindex);
err = vfsub_mnt_want_write(h_mnt);
if (!err) {
err = vfsub_update_time(h_inode, ts, flags);
err = vfsub_update_time(h_inode, flags);
vfsub_mnt_drop_write(h_mnt);
}
} else if (au_is_special(h_inode)) {

View File

@ -824,7 +824,7 @@ int aufs_link(struct dentry *src_dentry, struct inode *dir,
au_dir_ts(dir, a->bdst);
inode_inc_iversion(dir);
inc_nlink(inode);
inode->i_ctime = dir->i_ctime;
inode_set_ctime_to_ts( inode, inode_get_ctime(dir));
d_instantiate(dentry, au_igrab(inode));
if (d_unhashed(a->h_path.dentry))
/* some filesystem calls d_drop() */

View File

@ -277,7 +277,8 @@ static void epilog(struct inode *dir, struct dentry *dentry,
inode = d_inode(dentry);
d_drop(dentry);
inode->i_ctime = dir->i_ctime;
//inode->i_ctime = dir->i_ctime;
inode_set_ctime_to_ts(inode, inode_get_ctime(dir));
au_dir_ts(dir, bindex);
inode_inc_iversion(dir);
@ -379,10 +380,12 @@ int aufs_unlink(struct inode *dir, struct dentry *dentry)
if (bindex == btop) {
vfsub_update_h_iattr(&a->h_path, /*did*/NULL);
/*ignore*/
inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime;
//inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime;
inode_set_ctime_to_ts(inode, inode_get_ctime(d_inode(a->h_path.dentry)) );
} else
/* todo: this timestamp may be reverted later */
inode->i_ctime = h_dir->i_ctime;
//inode->i_ctime = h_dir->i_ctime;
inode_set_ctime_to_ts(inode,inode_get_ctime(h_dir) );
goto out_unpin; /* success */
}

View File

@ -443,12 +443,14 @@ static int do_rename(struct au_ren_args *a)
AuDebugOn(au_dbtop(a->dst_dentry) != a->btgt);
a->h_path.dentry = au_h_dptr(a->dst_dentry, a->btgt);
vfsub_update_h_iattr(&a->h_path, /*did*/NULL); /*ignore*/
a->dst_inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime;
//a->dst_inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime;
inode_set_ctime_to_ts( a->dst_inode, inode_get_ctime(d_inode(a->h_path.dentry)) );
}
AuDebugOn(au_dbtop(a->src_dentry) != a->btgt);
a->h_path.dentry = au_h_dptr(a->src_dentry, a->btgt);
vfsub_update_h_iattr(&a->h_path, /*did*/NULL); /*ignore*/
a->src_inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime;
//a->src_inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime;
inode_set_ctime_to_ts( a->src_inode, inode_get_ctime(d_inode(a->h_path.dentry)) );
if (!a->exchange) {
/* remove whiteout for dentry */

View File

@ -240,10 +240,9 @@ static inline void vfsub_touch_atime(struct vfsmount *h_mnt,
}
#endif
static inline int vfsub_update_time(struct inode *h_inode,
struct timespec64 *ts, int flags)
static inline int vfsub_update_time(struct inode *h_inode, int flags)
{
return inode_update_time(h_inode, ts, flags);
return inode_update_time(h_inode, flags);
/* no vfsub_update_h_iattr() since we don't have struct path */
}