]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: handle DISCARD failing with EBUSY gracefully
authorLennart Poettering <lennart@poettering.net>
Fri, 19 Mar 2021 21:25:09 +0000 (22:25 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 19 Apr 2021 21:16:02 +0000 (23:16 +0200)
src/partition/repart.c

index ac6e4e7f862505cd5de68b045ee83372b50ad331..351b3d1b5e959bda44126b62f9ff44b269df6de1 100644 (file)
@@ -2269,6 +2269,11 @@ static int context_discard_partition(Context *context, Partition *p) {
                 log_info("Storage does not support discard, not discarding data in future partition %" PRIu64 ".", p->partno);
                 return 0;
         }
+        if (r == -EBUSY) {
+                /* Let's handle this gracefully: https://bugzilla.kernel.org/show_bug.cgi?id=211167 */
+                log_info("Block device is busy, not discarding partition %" PRIu64 " because it probably is mounted.", p->partno);
+                return 0;
+        }
         if (r == 0) {
                 log_info("Partition %" PRIu64 " too short for discard, skipping.", p->partno);
                 return 0;