return err;
}
+static int ovl_get_upper(struct ovl_fs *ufs, struct path *upperpath)
+{
+ struct vfsmount *upper_mnt;
+
+ upper_mnt = clone_private_mount(upperpath);
+ if (IS_ERR(upper_mnt)) {
+ pr_err("overlayfs: failed to clone upperpath\n");
+ return PTR_ERR(upper_mnt);
+ }
+
+ /* Don't inherit atime flags */
+ upper_mnt->mnt_flags &= ~(MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME);
+ ufs->upper_mnt = upper_mnt;
+
+ return 0;
+}
+
static int ovl_get_lowerstack(struct super_block *sb, struct ovl_fs *ufs,
struct path **stackp, unsigned int *stacklenp)
{
goto out_unlock_workdentry;
if (ufs->config.upperdir) {
- ufs->upper_mnt = clone_private_mount(&upperpath);
- err = PTR_ERR(ufs->upper_mnt);
- if (IS_ERR(ufs->upper_mnt)) {
- pr_err("overlayfs: failed to clone upperpath\n");
+ err = ovl_get_upper(ufs, &upperpath);
+ if (err)
goto out_put_lowerpath;
- }
-
- /* Don't inherit atime flags */
- ufs->upper_mnt->mnt_flags &= ~(MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME);
sb->s_time_gran = ufs->upper_mnt->mnt_sb->s_time_gran;