public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] ovl: fix mount fail because the upper doesn't have space
@ 2023-07-19  8:54 Yunlong Xing
  2023-07-19  9:08 ` Amir Goldstein
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Yunlong Xing @ 2023-07-19  8:54 UTC (permalink / raw)
  To: miklos, amir73il
  Cc: linux-unionfs, linux-kernel, zhiguo.niu, hongyu.jin,
	yunlongxing23

The current ovlfs mount flow:

ovl_fill_super
 |_ovl_get_workdir
    |_ovl_make_workdir
       |_ovl_check_rename_whiteout

In ovl_check_rename_whiteout(), a new file is attempted to create.But if
the upper doesn't have space to do this, it will return error -ENOSPC,
causing the mount fail. It means that if the upper is full, the overlayfs
cannot be mounted.It is not reasonable, so this patch will omit this error
 and continue mount flow.

Fixes: cad218ab3320 ("ovl: check if upper fs supports RENAME_WHITEOUT")
Cc: stable@vger.kernel.org
Signed-off-by: Yunlong Xing <yunlong.xing@unisoc.com>
---
changes of v2: Following Amir's suggestion, assuming it is not supported
if the check fails because the upper does't have space
---
 fs/overlayfs/super.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 5b069f1a1e44..2b33c56fe4d7 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -744,12 +744,13 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
 
 	/* Check if upper/work fs supports RENAME_WHITEOUT */
 	err = ovl_check_rename_whiteout(ofs);
-	if (err < 0)
+	if (err < 0 && err != -ENOSPC)
 		goto out;
 
-	rename_whiteout = err;
+	rename_whiteout = err > 0;
 	if (!rename_whiteout)
-		pr_warn("upper fs does not support RENAME_WHITEOUT.\n");
+		pr_warn("upper fs does not support RENAME_WHITEOUT (%i).\n,
+			err");
 
 	/*
 	 * Check if upper/work fs supports (trusted|user).overlay.* xattr
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-19 13:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-19  8:54 [PATCH V2] ovl: fix mount fail because the upper doesn't have space Yunlong Xing
2023-07-19  9:08 ` Amir Goldstein
2023-07-19 11:26 ` kernel test robot
2023-07-19 12:17 ` kernel test robot
2023-07-19 12:28 ` kernel test robot
2023-07-19 13:40 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox