Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Sidong Yang <realwakka@gmail.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [RFC PATCH] btrfs-progs: filesystem: du: skip file that permission denied
Date: Sun, 21 Nov 2021 14:53:02 +0000	[thread overview]
Message-ID: <20211121145302.GA8836@realwakka> (raw)
In-Reply-To: <fb414950-fb0d-d24a-08f3-c0247f9bff9b@suse.com>

On Sun, Nov 21, 2021 at 11:01:02AM +0200, Nikolay Borisov wrote:
> 
> 
> On 21.11.21 г. 9:47, Sidong Yang wrote:
> > This patch handles issue #421. Filesystem du command fails and exit
> > when it access file that has permission denied. But it can continue the
> > command except the files. This patch recovers ret value when permission
> > denied.
> > 
> > Signed-off-by: Sidong Yang <realwakka@gmail.com>
> > ---
> >  cmds/filesystem-du.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/cmds/filesystem-du.c b/cmds/filesystem-du.c
> > index 5865335d..64a1f7f5 100644
> > --- a/cmds/filesystem-du.c
> > +++ b/cmds/filesystem-du.c
> > @@ -406,6 +406,9 @@ static int du_walk_dir(struct du_dir_ctxt *ctxt, struct rb_root *shared_extents)
> >  				if (ret == -ENOTTY) {
> >  					ret = 0;
> >  					continue;
> > +				} else if (ret == -EACCES) {
> 
> This can be added to the above condition with || ret == -EACCESS. Avoids
> code duplication.

Thanks! It would be better. 
> 
> > +					ret = 0;
> > +					continue;
> >  				} else if (ret) {
> >  					errno = -ret;
> >  					fprintf(stderr,
> > 

      reply	other threads:[~2021-11-21 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-21  7:47 [RFC PATCH] btrfs-progs: filesystem: du: skip file that permission denied Sidong Yang
2021-11-21  9:01 ` Nikolay Borisov
2021-11-21 14:53   ` Sidong Yang [this message]

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=20211121145302.GA8836@realwakka \
    --to=realwakka@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.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