static noinline_for_stack int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src, struct au_cpup_reg_attr *h_src_attr) { int err, sbits; struct iattr ia; struct path h_path; struct inode *h_isrc, *h_idst; struct kstat *h_st; h_path.dentry = au_h_dptr(dst, bindex); h_idst = h_path.dentry->d_inode; h_path.mnt = au_sbr_mnt(dst->d_sb, bindex); h_isrc = h_src->d_inode; ia.ia_valid = ATTR_FORCE | ATTR_UID | ATTR_GID | ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET; if (h_src_attr && h_src_attr->valid) { h_st = &h_src_attr->st; ia.ia_uid = h_st->uid; ia.ia_gid = h_st->gid; ia.ia_atime = h_st->atime; ia.ia_mtime = h_st->mtime; if (h_idst->i_mode != h_st->mode && !S_ISLNK(h_idst->i_mode)) { ia.ia_valid |= ATTR_MODE; ia.ia_mode = h_st->mode; } sbits = !!(h_st->mode & (S_ISUID | S_ISGID)); au_cpup_attr_flags(h_idst, h_src_attr->iflags); } else { ia.ia_uid = h_isrc->i_uid; ia.ia_gid = h_isrc->i_gid; ia.ia_atime = h_isrc->i_atime; ia.ia_mtime = h_isrc->i_mtime; if (h_idst->i_mode != h_isrc->i_mode && !S_ISLNK(h_idst->i_mode)) { ia.ia_valid |= ATTR_MODE; ia.ia_mode = h_isrc->i_mode; } sbits = !!(h_isrc->i_mode & (S_ISUID | S_ISGID)); au_cpup_attr_flags(h_idst, h_isrc->i_flags); } err = vfsub_notify_change(&h_path, &ia); /* is this nfs only? */ if (!err && sbits && au_test_nfs(h_path.dentry->d_sb)) { ia.ia_valid = ATTR_FORCE | ATTR_MODE; ia.ia_mode = h_isrc->i_mode; err = vfsub_notify_change(&h_path, &ia); } return err; }
/* subset of cpup_attr() */ static noinline_for_stack int au_cpdown_attr(struct path *h_path, struct dentry *h_src) { int err, sbits; struct iattr ia; struct inode *h_isrc; h_isrc = h_src->d_inode; ia.ia_valid = ATTR_FORCE | ATTR_MODE | ATTR_UID | ATTR_GID; ia.ia_mode = h_isrc->i_mode; ia.ia_uid = h_isrc->i_uid; ia.ia_gid = h_isrc->i_gid; sbits = !!(ia.ia_mode & (S_ISUID | S_ISGID)); au_cpup_attr_flags(h_path->dentry->d_inode, h_isrc); err = vfsub_sio_notify_change(h_path, &ia); /* is this nfs only? */ if (!err && sbits && au_test_nfs(h_path->dentry->d_sb)) { ia.ia_valid = ATTR_FORCE | ATTR_MODE; ia.ia_mode = h_isrc->i_mode; err = vfsub_sio_notify_change(h_path, &ia); } return err; }
static noinline_for_stack int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src) { int err, sbits; struct iattr ia; struct path h_path; struct inode *h_isrc; h_path.dentry = au_h_dptr(dst, bindex); h_path.mnt = au_sbr_mnt(dst->d_sb, bindex); h_isrc = h_src->d_inode; ia.ia_valid = ATTR_FORCE | ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET; ia.ia_mode = h_isrc->i_mode; ia.ia_uid = h_isrc->i_uid; ia.ia_gid = h_isrc->i_gid; ia.ia_atime = h_isrc->i_atime; ia.ia_mtime = h_isrc->i_mtime; sbits = !!(ia.ia_mode & (S_ISUID | S_ISGID)); au_cpup_attr_flags(h_path.dentry->d_inode, h_isrc); err = vfsub_notify_change(&h_path, &ia); /* is this nfs only? */ if (!err && sbits && au_test_nfs(h_path.dentry->d_sb)) { ia.ia_valid = ATTR_FORCE | ATTR_MODE; ia.ia_mode = h_isrc->i_mode; err = vfsub_notify_change(&h_path, &ia); } return err; }
void au_cpup_attr_changeable(struct inode *inode) { struct inode *h_inode; h_inode = au_h_iptr(inode, au_ibstart(inode)); inode->i_mode = h_inode->i_mode; inode->i_uid = h_inode->i_uid; inode->i_gid = h_inode->i_gid; au_cpup_attr_timesizes(inode); au_cpup_attr_flags(inode, h_inode); }
void au_cpup_attr_changeable(struct inode *inode) { struct inode *h_inode; LKTRTrace("i%lu\n", inode->i_ino); /* todo? IMustLock(inode); */ h_inode = au_h_iptr(inode, au_ibstart(inode)); AuDebugOn(!h_inode); inode->i_mode = h_inode->i_mode; inode->i_uid = h_inode->i_uid; inode->i_gid = h_inode->i_gid; au_cpup_attr_timesizes(inode); au_cpup_attr_flags(inode, h_inode); }
static noinline_for_stack int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src, struct au_hinode *hdir, struct vfsub_args *vargs) { int err, sbits; struct dentry *h_dst; struct iattr ia; struct inode *h_isrc, *h_idst; h_dst = au_h_dptr(dst, bindex); LKTRTrace("%.*s\n", AuDLNPair(h_dst)); h_idst = h_dst->d_inode; /* todo? IMustLock(h_idst); */ h_isrc = h_src->d_inode; /* todo? IMustLock(h_isrc); */ ia.ia_valid = ATTR_FORCE | ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET; ia.ia_mode = h_isrc->i_mode; ia.ia_uid = h_isrc->i_uid; ia.ia_gid = h_isrc->i_gid; ia.ia_atime = h_isrc->i_atime; ia.ia_mtime = h_isrc->i_mtime; sbits = !!(ia.ia_mode & (S_ISUID | S_ISGID)); au_cpup_attr_flags(h_idst, h_isrc); vfsub_args_reinit(vargs); vfsub_ign_hinode(vargs, IN_ATTRIB, hdir); err = vfsub_notify_change(h_dst, &ia, vargs); /* is this nfs only? */ if (!err && sbits && au_test_nfs(h_dst->d_sb)) { ia.ia_valid = ATTR_FORCE | ATTR_MODE; ia.ia_mode = h_isrc->i_mode; vfsub_args_reinit(vargs); vfsub_ign_hinode(vargs, IN_ATTRIB, hdir); err = vfsub_notify_change(h_dst, &ia, vargs); } AuTraceErr(err); return err; }
static noinline_for_stack int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src, struct au_cpup_reg_attr *h_src_attr) { int err, sbits, icex; unsigned int mnt_flags; unsigned char verbose; struct iattr ia; struct path h_path; struct inode *h_isrc, *h_idst; struct kstat *h_st; struct au_branch *br; h_path.dentry = au_h_dptr(dst, bindex); h_idst = d_inode(h_path.dentry); br = au_sbr(dst->d_sb, bindex); h_path.mnt = au_br_mnt(br); h_isrc = d_inode(h_src); ia.ia_valid = ATTR_FORCE | ATTR_UID | ATTR_GID | ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET; if (h_src_attr && h_src_attr->valid) { h_st = &h_src_attr->st; ia.ia_uid = h_st->uid; ia.ia_gid = h_st->gid; ia.ia_atime = h_st->atime; ia.ia_mtime = h_st->mtime; if (h_idst->i_mode != h_st->mode && !S_ISLNK(h_idst->i_mode)) { ia.ia_valid |= ATTR_MODE; ia.ia_mode = h_st->mode; } sbits = !!(h_st->mode & (S_ISUID | S_ISGID)); au_cpup_attr_flags(h_idst, h_src_attr->iflags); } else { ia.ia_uid = h_isrc->i_uid; ia.ia_gid = h_isrc->i_gid; ia.ia_atime = h_isrc->i_atime; ia.ia_mtime = h_isrc->i_mtime; if (h_idst->i_mode != h_isrc->i_mode && !S_ISLNK(h_idst->i_mode)) { ia.ia_valid |= ATTR_MODE; ia.ia_mode = h_isrc->i_mode; } sbits = !!(h_isrc->i_mode & (S_ISUID | S_ISGID)); au_cpup_attr_flags(h_idst, h_isrc->i_flags); } /* no delegation since it is just created */ err = vfsub_notify_change(&h_path, &ia, /*delegated*/NULL); /* is this nfs only? */ if (!err && sbits && au_test_nfs(h_path.dentry->d_sb)) { ia.ia_valid = ATTR_FORCE | ATTR_MODE; ia.ia_mode = h_isrc->i_mode; err = vfsub_notify_change(&h_path, &ia, /*delegated*/NULL); } icex = br->br_perm & AuBrAttr_ICEX; if (!err) { mnt_flags = au_mntflags(dst->d_sb); verbose = !!au_opt_test(mnt_flags, VERBOSE); err = au_cpup_xattr(h_path.dentry, h_src, icex, verbose); } return err; }