* [PATCH v3] btrfs-progs: filesystem: du: skip file that permission denied
@ 2021-11-22 15:54 Sidong Yang
2021-11-30 17:43 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Sidong Yang @ 2021-11-22 15:54 UTC (permalink / raw)
To: Nikolay Borisov, Graham Cobb, linux-btrfs, David Sterba; +Cc: Sidong Yang
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 prints error message just like
/bin/du does and it continues if it can.
Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
v3:
- prints error message like /bin/du does
---
cmds/filesystem-du.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/cmds/filesystem-du.c b/cmds/filesystem-du.c
index 5865335d..7ea2da85 100644
--- a/cmds/filesystem-du.c
+++ b/cmds/filesystem-du.c
@@ -403,14 +403,14 @@ static int du_walk_dir(struct du_dir_ctxt *ctxt, struct rb_root *shared_extents)
dirfd(dirstream),
shared_extents, &tot, &shr,
0);
- if (ret == -ENOTTY) {
- ret = 0;
- continue;
- } else if (ret) {
+ if (ret) {
errno = -ret;
- fprintf(stderr,
- "failed to walk dir/file: %s : %m\n",
- entry->d_name);
+ fprintf(stderr, "cannot access: '%s:' %m\n",
+ entry->d_name);
+ if (ret == -ENOTTY || ret == -EACCES) {
+ ret = 0;
+ continue;
+ }
break;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] btrfs-progs: filesystem: du: skip file that permission denied
2021-11-22 15:54 [PATCH v3] btrfs-progs: filesystem: du: skip file that permission denied Sidong Yang
@ 2021-11-30 17:43 ` David Sterba
2021-12-05 15:13 ` Sidong Yang
0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2021-11-30 17:43 UTC (permalink / raw)
To: Sidong Yang; +Cc: Nikolay Borisov, Graham Cobb, linux-btrfs, David Sterba
On Mon, Nov 22, 2021 at 03:54:11PM +0000, Sidong Yang wrote:
> This patch handles issue #421.
The issue is about descending to mount points, while you add handling of
permissions. Is it referring to the right issue?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] btrfs-progs: filesystem: du: skip file that permission denied
2021-11-30 17:43 ` David Sterba
@ 2021-12-05 15:13 ` Sidong Yang
0 siblings, 0 replies; 3+ messages in thread
From: Sidong Yang @ 2021-12-05 15:13 UTC (permalink / raw)
To: dsterba, Nikolay Borisov, Graham Cobb, linux-btrfs, David Sterba
On Tue, Nov 30, 2021 at 06:43:40PM +0100, David Sterba wrote:
> On Mon, Nov 22, 2021 at 03:54:11PM +0000, Sidong Yang wrote:
> > This patch handles issue #421.
>
> The issue is about descending to mount points, while you add handling of
> permissions. Is it referring to the right issue?
I understood it as a permission issue. Because the issue describe that
it can not descend into a folder because of permission. So, I patched
about permission. It could be solved with skipping all decending mount
points. But I think it's little awkward because "/bin/du" doesn't work
like it.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-05 15:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-22 15:54 [PATCH v3] btrfs-progs: filesystem: du: skip file that permission denied Sidong Yang
2021-11-30 17:43 ` David Sterba
2021-12-05 15:13 ` Sidong Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox