Skip to content
Permalink
Browse files
overlayfs: propagate errors from upper to overlay sb in sync_fs
Peek at the upper layer's errseq_t at mount time for volatile mounts,
and record it in the per-sb info. In sync_fs, check for an error since
the recorded point and set it in the overlayfs superblock if there was
one.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
  • Loading branch information
jtlayton authored and intel-lab-lkp committed Dec 13, 2020
1 parent 1f6507f commit 89bd90a6b2a9bc40a46e9b9de68356e99cde04e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
@@ -81,6 +81,7 @@ struct ovl_fs {
atomic_long_t last_ino;
/* Whiteout dentry cache */
struct dentry *whiteout;
errseq_t err_mark;
};

static inline struct vfsmount *ovl_upper_mnt(struct ovl_fs *ofs)
@@ -267,8 +267,13 @@ static int ovl_sync_fs(struct super_block *sb, int wait)
if (!ovl_upper_mnt(ofs))
return 0;

if (!ovl_should_sync(ofs))
return 0;
if (!ovl_should_sync(ofs)) {
/* Propagate errors from upper to overlayfs */
ret = errseq_check(&upper_sb->s_wb_err, ofs->err_mark);
errseq_set(&sb->s_wb_err, ret);
return ret;
}

/*
* Not called for sync(2) call or an emergency sync (SB_I_SKIP_SYNC).
* All the super blocks will be iterated, including upper_sb.
@@ -2007,8 +2012,11 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)

sb->s_stack_depth = ovl_upper_mnt(ofs)->mnt_sb->s_stack_depth;
sb->s_time_gran = ovl_upper_mnt(ofs)->mnt_sb->s_time_gran;

}

if (ofs->config.ovl_volatile)
ofs->err_mark = errseq_peek(&ovl_upper_mnt(ofs)->mnt_sb->s_wb_err);

oe = ovl_get_lowerstack(sb, splitlower, numlower, ofs, layers);
err = PTR_ERR(oe);
if (IS_ERR(oe))

0 comments on commit 89bd90a

Please sign in to comment.