All of lore.kernel.org
 help / color / mirror / Atom feed
* two questiones about overlayfs
@ 2017-08-07  7:57 zhangyi (F)
  2017-08-08  5:01 ` Amir Goldstein
  2017-09-11 13:34 ` Amir Goldstein
  0 siblings, 2 replies; 23+ messages in thread
From: zhangyi (F) @ 2017-08-07  7:57 UTC (permalink / raw)
  To: linux-unionfs; +Cc: miklos, Amir Goldstein, miaoxie

Hi,all:
I found two problemes about overlayfs, please let me know what you think:

1. Cannot update upper dir's access time.
Reproduce:
# mkdir lower upper worker merger
# mkdir upper/dir
# mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=worker overlayfs merger
# ls mrger/dir
# stat mrger/dir
  Access: 2017-08-07 11:03:56.364771584 -0400
  Modify: 2017-08-07 11:01:52.319771584 -0400
  Change: 2017-08-07 11:01:52.319771584 -0400
# touch mrger/dir/aa
# stat mrger/dir
  Access: 2017-08-07 11:03:56.364771584 -0400
  Modify: 2017-08-07 11:05:33.969771584 -0400
  Change: 2017-08-07 11:05:33.969771584 -0400
# ls mrger/dir
# stat mrger/dir
  Access: 2017-08-07 11:03:56.364771584 -0400
  Modify: 2017-08-07 11:05:33.969771584 -0400
  Change: 2017-08-07 11:05:33.969771584 -0400

I find the reason of this problem is in update_ovl_inode_times():
(598e3c8f7 "vfs: update ovl inode before relatime check")

static void update_ovl_inode_times(struct dentry *dentry, struct inode *inode,
			       bool rcu)
{
	if (!rcu) {
		struct inode *realinode = d_real_inode(dentry);

	*d_real_inode() cannot get dir's real inode, so i_mtime always equal to i_ctime*
	*an not updated*

		if (unlikely(inode != realinode) &&
		    (!timespec_equal(&inode->i_mtime, &realinode->i_mtime) ||
		     !timespec_equal(&inode->i_ctime, &realinode->i_ctime))) {
			inode->i_mtime = realinode->i_mtime;
			inode->i_ctime = realinode->i_ctime;
		}
	}
}

2. Chattr will modify lower file's attributes directly.
Reproduce:
# mkdir lower upper worker merger
# touch lower/aa
# lsattr -p lower/aa
    0 --------------e---- lower/aa
# mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=worker overlayfs merger
# chattr -p 123 merger/aa             #set project id
# lsattr -p lower/aa
  123 --------------e---- lower/aa

If we try to set "immutable" or any other attributes, the result are consistent.
Because chattr open file in RDONLY mode, so it will not trigger copyup, and then,
FS_IOC_SETFLAGS ioctl will get the lower inode and modify it. By the way,
ovl's directory not support ioctl now, so we fail to change dir's attributes.

Do you think these two "problemes" need to fix or should avoid ?

Thanks,
ZhangYi.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-09-12  1:08 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07  7:57 two questiones about overlayfs zhangyi (F)
2017-08-08  5:01 ` Amir Goldstein
2017-08-08 20:21   ` Vivek Goyal
2017-08-08 21:01     ` Daniel Walsh
2017-08-15 10:22   ` Miklos Szeredi
2017-08-15 13:35   ` Miklos Szeredi
2017-08-15 14:52     ` Amir Goldstein
2017-08-15 15:06       ` Miklos Szeredi
2017-08-15 15:28         ` Amir Goldstein
2017-08-15 15:33           ` Miklos Szeredi
2017-08-15 15:53             ` Amir Goldstein
2017-08-15 15:56             ` Vivek Goyal
2017-08-15 16:16               ` Amir Goldstein
2017-08-16 10:19                 ` Miklos Szeredi
2017-08-16 10:20                   ` Miklos Szeredi
2017-08-16 11:10                   ` Amir Goldstein
2017-08-17  2:55                     ` zhangyi (F)
2017-08-17  7:49                       ` Amir Goldstein
2017-08-16 13:52                   ` Vivek Goyal
2017-08-16 16:12                     ` Amir Goldstein
2017-08-16 18:37                       ` Vivek Goyal
2017-09-11 13:34 ` Amir Goldstein
2017-09-12  1:07   ` zhangyi (F)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.