Linux Overlay Filesystem development
 help / color / mirror / Atom feed
From: hujianyang <hujianyang@huawei.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Bastian Bittorf <bittorf@bluebottle.com>, linux-unionfs@vger.kernel.org
Subject: Re: linux / overlay / OpenWrt / problems with full working dir
Date: Tue, 19 May 2015 17:55:03 +0800	[thread overview]
Message-ID: <555B0877.3030807@huawei.com> (raw)
In-Reply-To: <20150519090339.GB9960@tucsk>

Hi Miklos,

On 2015/5/19 17:03, Miklos Szeredi wrote:
> 
> ---
>  fs/overlayfs/copy_up.c |    3 +++
>  fs/overlayfs/dir.c     |    9 +++++++++
>  fs/overlayfs/super.c   |   12 +++++++++---
>  3 files changed, 21 insertions(+), 3 deletions(-)
> 
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -300,6 +300,9 @@ int ovl_copy_up_one(struct dentry *paren
>  	struct cred *override_cred;
>  	char *link = NULL;
>  
> +	if (WARN_ON(!workdir))
> +		return -EROFS;
> +

When will this condition occur?

>  	ovl_path_upper(parent, &parentpath);
>  	upperdir = parentpath.dentry;
>  
> --- a/fs/overlayfs/dir.c
> +++ b/fs/overlayfs/dir.c
> @@ -222,6 +222,9 @@ static struct dentry *ovl_clear_empty(st
>  	struct kstat stat;
>  	int err;
>  
> +	if (WARN_ON(!workdir))
> +		return ERR_PTR(-EROFS);
> +
>  	err = ovl_lock_rename_workdir(workdir, upperdir);
>  	if (err)
>  		goto out;
> @@ -322,6 +325,9 @@ static int ovl_create_over_whiteout(stru
>  	struct dentry *newdentry;
>  	int err;
>  
> +	if (WARN_ON(!workdir))
> +		return -EROFS;
> +
>  	err = ovl_lock_rename_workdir(workdir, upperdir);
>  	if (err)
>  		goto out;
> @@ -506,6 +512,9 @@ static int ovl_remove_and_whiteout(struc
>  	struct dentry *opaquedir = NULL;
>  	int err;
>  
> +	if (WARN_ON(!workdir))
> +		return -EROFS;
> +
>  	if (is_dir) {
>  		opaquedir = ovl_check_empty_and_clear(dentry);
>  		err = PTR_ERR(opaquedir);
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -740,9 +740,15 @@ static int ovl_fill_super(struct super_b
>  	ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry);
>  	err = PTR_ERR(ufs->workdir);
>  	if (IS_ERR(ufs->workdir)) {
> -		pr_err("overlayfs: failed to create directory %s/%s\n",
> -		       ufs->config.workdir, OVL_WORKDIR_NAME);
> -		goto out_put_lower_mnt;
> +		if (err == -ENOSPC || err == -EROFS) {

Since upper fs should not be R/O after commit 71cbad7e694ee81,
could the return value here be -EROFS?

> +			pr_warning("overlayfs: failed to work directory (%s), mounting read-only\n", err == ENOSPC ? "ENOSPC" : "EROFS");
> +			sb->s_flags |= MS_RDONLY;
> +			ufs->workdir = NULL;
> +		} else {
> +			pr_err("overlayfs: failed to create directory %s/%s\n",
> +			       ufs->config.workdir, OVL_WORKDIR_NAME);
> +			goto out_put_lower_mnt;
> +		}
>  	}
>  
>  	/*
> --
> To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> .
> 

  reply	other threads:[~2015-05-19  9:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150519075120.GL28644@medion.lan>
2015-05-19  9:03 ` linux / overlay / OpenWrt / problems with full working dir Miklos Szeredi
2015-05-19  9:55   ` hujianyang [this message]
2015-05-19 12:00   ` Bastian Bittorf
2015-05-19 12:35     ` Miklos Szeredi

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=555B0877.3030807@huawei.com \
    --to=hujianyang@huawei.com \
    --cc=bittorf@bluebottle.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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