Petr Uzel wrote:
I do my tests with parted-1.8.8 [*], which still uses BLKPG* ioctls to
inform the kernel and thus the different codepath than your patch
modifies.

Anyway, I'm thinking about similar patch that would retry the
BLKPG_DEL_PARTITION several times, eventually with a short
sleep before the last try (fixing race condition with sleeping
is not a most robust solution, but I can't think of anything better
now).

[*] I know this version is 'a bit' older, but it is my primary concern
now (distribution stuff :/ )

I think your solution should work in most cases, however, the proper
fix would IMHO be to somehow gain exclusive access to the device to
prevent anything else from opening it. I don't know if it's doable,
though

Thank you Petr for the clarification that the kernel is responsible for updating the /proc/partitions entries.

I agree that a inserting a sleep(1) into the code in the hopes that a subsequent call to ioctl() will be successful is not a very robust solution. Having said that, it does appear to be working in my test case. My test has been running for over 4 days now and has completed over 54,000 iterations.

I have also tested parted-2.1 which suffers from a similar problem. Hence I have not found a solution to this problem in more recent versions of the upstream code.

Perhaps there is someone else on this mailing list that could propose a better approach to this problem?

Regards,
Curtis Gedak

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to