All of lore.kernel.org
 help / color / mirror / Atom feed
* rbd unmap fails with "Device or resource busy"
@ 2022-09-13  1:20 Chris Dunlop
  2022-09-13 11:43 ` Ilya Dryomov
  0 siblings, 1 reply; 16+ messages in thread
From: Chris Dunlop @ 2022-09-13  1:20 UTC (permalink / raw)
  To: ceph-devel

Hi,

What can make a "rbd unmap" fail, assuming the device is not mounted and not 
(obviously) open by any other processes?

linux-5.15.58
ceph-16.2.9

I have multiple XFS on rbd filesystems, and often create rbd snapshots, map 
and read-only mount the snapshot, perform some work on the fs, then unmount 
and unmap. The unmap regularly (about 1 in 10 times) fails like:

$ sudo rbd unmap /dev/rbd29
rbd: sysfs write failed
rbd: unmap failed: (16) Device or resource busy

I've double checked the device is no longer mounted, and, using "lsof" etc., 
nothing has the device open.

A "rbd unmap -f" can unmap the "busy" device but I'm concerned this may have 
undesirable consequences, e.g. ceph resource leakage, or even potential data 
corruption on non-read-only mounts.

I've found that waiting "a while", e.g. 5-30 minutes, will usually allow the 
"busy" device to be unmapped without the -f flag.

A simple "map/mount/read/unmount/unmap" test sees the unmap fail about 1 in 10 
times. When it fails it often takes 30 min or more for the unmap to finally 
succeed. E.g.:

----------------------------------------
#!/bin/bash

set -e

rbdname=pool/name

for ((i=0; ++i<=50; )); do
   dev=$(rbd map "${rbdname}")
   mount -oro,norecovery,nouuid "${dev}" /mnt/test

   dd if="/mnt/test/big-file" of=/dev/null bs=1G count=1
   umount /mnt/test
   # blockdev --flushbufs "${dev}"
   for ((j=0; ++j; )); do
     rbd unmap "${rdev}" && break
     sleep 5m
   done
done
----------------------------------------

Running "blockdev --flushbufs" prior to the unmap doesn't change the unmap 
failures.

What can I look at to see what's causing these unmaps to fail?

Chris

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-09-30 13:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13  1:20 rbd unmap fails with "Device or resource busy" Chris Dunlop
2022-09-13 11:43 ` Ilya Dryomov
2022-09-14  3:49   ` Chris Dunlop
2022-09-14  8:41     ` Ilya Dryomov
2022-09-15  8:29       ` Chris Dunlop
2022-09-19  7:43         ` Chris Dunlop
2022-09-19 10:14           ` Ilya Dryomov
2022-09-21  1:36             ` Chris Dunlop
2022-09-21 10:40               ` Ilya Dryomov
2022-09-23  3:58                 ` Chris Dunlop
2022-09-23  9:47                   ` Ilya Dryomov
2022-09-28  0:22                     ` Chris Dunlop
2022-09-29 11:14                       ` Ilya Dryomov
2022-09-30  0:04                         ` Chris Dunlop
2022-09-30 13:26                           ` Ilya Dryomov
     [not found]                   ` <CANqTTH4dPibtJ_4ayDch5rKVG=ykGAJhWnCyWmG9vvm1zHEg1w@mail.gmail.com>
2022-09-27 10:55                     ` Ilya Dryomov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.