ovl: fix error code for ovl_fill_super()
PATCH v2 1/1 ovl: fix error code for ovl_fill_super()
Fix some incorrect error codes for ovl_fill_super() and change to set error code in a consistent way.
Suggested-by Amir Goldstein <[email protected]>
Signed-off-by Chengguang Xu <[email protected]>
--- fs/overlayfs/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/overlayfs/super.c +4 -1
@@ -1980,6 +1980,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)if (!splitlower) goto out_err; + err = -EINVAL ; numlower =ovl_split_lowerdirs (splitlower);if (numlower >OVL_MAX_STACK ) { pr_err("too many lower directories, limit is %d\n",
@@ -1987,6 +1988,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) goto out_err; } + err = -ENOMEM ; layers =kcalloc (numlower +1 ,sizeof (struct ovl_layer ),GFP_KERNEL );if (!layers) goto out_err;
@@ -2013,6 +2015,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)if (ofs->config.upperdir) {struct super_block *upper_sb; + err = -EINVAL ;if (!ofs->config.workdir) {pr_err ("missing 'workdir'\n" ); goto out_err;
@@ -2022,11 +2025,11 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)if (err) goto out_err; + err = -EIO ; upper_sb =ovl_upper_mnt (ofs)->mnt_sb;if (!ovl_should_sync (ofs)) { ofs->errseq =errseq_sample (&upper_sb->s_wb_err);if (errseq_check (&upper_sb->s_wb_err, ofs->errseq)) { - err = -EIO ;pr_err ("Cannot mount volatile when upperdir has an unseen error. Sync upperdir fs to clear state.\n" ); goto out_err; }
Signature · 1 line
2.27.0