Re: Can't scan new disk
- Date: Wed, 20 Feb 2019 11:20:06 +0100
- From: "Thomas Schmitt" <scdbackup@xxxxxxx>
- Subject: Re: Can't scan new disk
Mark Allums wrote:
> The disk is not mounted.
At least not from the perception of e2fsck, indeed, or else it would say
"%s is mounted.\n"
"%s is in use.\n"
If i understand the code correctly, the program gets to that spot because
if ((!(ctx->mount_flags & (EXT2_MF_MOUNTED | EXT2_MF_BUSY))) ||
is not true. It says "is in use", because
if (ctx->mount_flags & EXT2_MF_MOUNTED)
is not true. I.e. (ctx->mount_flags & EXT2_MF_BUSY) is true.
I bet that it is about open(2)/fcntl(2) flag O_EXCL, because of
where i see
int fd = open(device, O_RDONLY | O_EXCL);
if (fd >= 0)
else if (errno == EBUSY)
*mount_flags |= EXT2_MF_BUSY;
O_EXCL has a special meaning with Linux device files. It works as advisory
locking with this file type only. In the context of mounting, a failure
with O_EXCL and success without that flag instructs the mounter to mount
read-only. In the context of CD burning, it tells an interested drive
groping program (except mount(8)) to leave the drive alone. Even cdrecord
joined that party.
So one should hop back to the sub-thread where open file pointers to
/dev/sdb1 were the main suspects.
fcntl(2) would be able to inquire the O_EXCL flag by command F_GETFL,
but it needs the file descriptor which is an integer number in the context
of the using process. Dunno whether it is possible to inquire this from
Have a nice day :)