diff options
-rw-r--r-- | sys-utils/fstrim.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index ff029015e..ea29a5695 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -311,6 +311,14 @@ static int fstrim_all(struct fstrim_control *ctl) if (rc) continue; /* overlaying mount */ + /* FSTRIM on read-only filesystem can fail, and it can fail */ + if (access(path, W_OK) != 0) { + if (errno == EROFS) + continue; + if (errno == EACCES) + continue; + } + if (!has_discard(src, &wholedisk)) continue; cnt++; |