From: Lennart Poettering Date: Fri, 19 Mar 2021 21:25:09 +0000 (+0100) Subject: repart: handle DISCARD failing with EBUSY gracefully X-Git-Tag: v249-rc1~388^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22163eb51b682afe969f9381d56315dade874ec1;p=thirdparty%2Fsystemd.git repart: handle DISCARD failing with EBUSY gracefully --- diff --git a/src/partition/repart.c b/src/partition/repart.c index ac6e4e7f862..351b3d1b5e9 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -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;