linux-unionfs mirror
 help / color / mirror / Atom feed
From: Yunlong Xing <yunlong.xing@unisoc.com>
To: <miklos@szeredi.hu>, <amir73il@gmail.com>
Cc: <linux-unionfs@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<zhiguo.niu@unisoc.com>, <hongyu.jin@unisoc.com>,
	<yunlongxing23@gmail.com>
Subject: [PATCH V3] ovl: fix mount fail because the upper doesn't have space
Date: Thu, 20 Jul 2023 17:14:36 +0800	[thread overview]
Message-ID: <20230720091436.399691-1-yunlong.xing@unisoc.com> (raw)

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
---
changes of v3: fix error of the '"' character in pr_warn()
---
 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..486493711650 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

base-commit: eb26cbb1a754ccde5d4d74527dad5ba051808fad
-- 
2.25.1


             reply	other threads:[~2023-07-20  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  9:14 Yunlong Xing [this message]
2023-08-01 17:43 ` [PATCH V3] ovl: fix mount fail because the upper doesn't have space Miklos Szeredi
2023-08-02  2:11   ` yunlong xing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230720091436.399691-1-yunlong.xing@unisoc.com \
    --to=yunlong.xing@unisoc.com \
    --cc=amir73il@gmail.com \
    --cc=hongyu.jin@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=yunlongxing23@gmail.com \
    --cc=zhiguo.niu@unisoc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).