/* * copy-down the file and unlink the bsrc file. * - unlink the bdst whout if exist * - copy-down the file (with whtmp name and rename) * - unlink the bsrc file */ static int au_do_mvdown(const unsigned char dmsg, struct au_mvd_args *a) { int err; err = au_do_mkdir(dmsg, a); if (!err) err = au_do_lock(dmsg, a); if (unlikely(err)) goto out; /* * do not revert the activities we made on bdst since they should be * harmless in aufs. */ err = au_do_cpdown(dmsg, a); if (!err) err = au_do_unlink_wh(dmsg, a); if (!err && !(a->mvdown.flags & AUFS_MVDOWN_KUPPER)) err = au_do_unlink(dmsg, a); if (unlikely(err)) goto out_unlock; AuDbg("%pd2, 0x%x, %d --> %d\n", a->dentry, a->mvdown.flags, a->mvd_bsrc, a->mvd_bdst); if (find_lower_writable(a) < 0) a->mvdown.flags |= AUFS_MVDOWN_BOTTOM; if (a->mvdown.flags & AUFS_MVDOWN_STFS) au_do_stfs(dmsg, a); /* maintain internal array */ if (!(a->mvdown.flags & AUFS_MVDOWN_KUPPER)) { au_set_h_dptr(a->dentry, a->mvd_bsrc, NULL); au_set_dbtop(a->dentry, a->mvd_bdst); au_set_h_iptr(a->inode, a->mvd_bsrc, NULL, /*flags*/0); au_set_ibtop(a->inode, a->mvd_bdst); } else { /* hide the lower */ au_set_h_dptr(a->dentry, a->mvd_bdst, NULL); au_set_dbbot(a->dentry, a->mvd_bsrc); au_set_h_iptr(a->inode, a->mvd_bdst, NULL, /*flags*/0); au_set_ibbot(a->inode, a->mvd_bsrc); } if (au_dbbot(a->dentry) < a->mvd_bdst) au_set_dbbot(a->dentry, a->mvd_bdst); if (au_ibbot(a->inode) < a->mvd_bdst) au_set_ibbot(a->inode, a->mvd_bdst); out_unlock: au_do_unlock(dmsg, a); out: AuTraceErr(err); return err; }
/* * copy-down the file and unlink the bsrc file. * - unlink the bdst whout if exist * - copy-down the file (with whtmp name and rename) * - unlink the bsrc file */ static int au_do_mvdown(const unsigned char dmsg, struct au_mvd_args *a) { int err; err = au_do_mkdir(dmsg, a); if (!err) err = au_do_lock(dmsg, a); if (unlikely(err)) goto out; /* * do not revert the activities we made on bdst since they should be * harmless in aufs. */ err = au_do_cpdown(dmsg, a); if (!err) err = au_do_unlink_wh(dmsg, a); if (!err && !(a->mvdown.flags & AUFS_MVDOWN_KUPPER)) err = au_do_unlink(dmsg, a); if (unlikely(err)) goto out_unlock; /* maintain internal array */ if (!(a->mvdown.flags & AUFS_MVDOWN_KUPPER)) { au_set_h_dptr(a->dentry, a->mvd_bsrc, NULL); au_set_dbstart(a->dentry, a->mvd_bdst); au_set_h_iptr(a->inode, a->mvd_bsrc, NULL, /*flags*/0); au_set_ibstart(a->inode, a->mvd_bdst); } if (au_dbend(a->dentry) < a->mvd_bdst) au_set_dbend(a->dentry, a->mvd_bdst); if (au_ibend(a->inode) < a->mvd_bdst) au_set_ibend(a->inode, a->mvd_bdst); out_unlock: au_do_unlock(dmsg, a); out: AuTraceErr(err); return err; }