btrfs-progs: filesystem: du: skip file that permission denied
PATCH v3 1/1 btrfs-progs: filesystem: du: skip file that permission denied
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.
---
v3:
- prints error message like /bin/du does
--- cmds/filesystem-du.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
cmds/filesystem-du.c +7 -7
@@ -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 ; }
Signature · 1 line
2.25.1
Quoted 1 line · Sidong Yang
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?
Quoted 5 lines · David Sterba
Quoted 1 line · Sidong Yang
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.