Thread (6 messages) 6 messages, 3 authors, 2011-01-17

Re: open_dev_excl in reshape_container() fails

From: Dan Williams <hidden>
Date: 2011-01-13 17:27:34

2011/1/13 Kwolek, Adam [off-list ref]:
Hi,

I've got a problem using open_dev_excl() in reshape_container(), it fails. This functions goes down
and calls open() with flags O_DIRECT| O_RDWR| O_EXCL.
It fails in reshape_container(), ealier in Grow_reshape() exactly the same test call to open_dev_excl() succeed.
Between test open and open in reshape_container() there is no other open() performed (or other i/o operation that can cause problem).
It not depends on mdmon action because it is the same for raid5 and raid0.
Function open_dev() works, and I'm using it as workaround.

In man pages for open() is told that O_EXCL flag should be used with O_CREAT flag only.
I've read in manual for open() also: "If O_EXCL is set and O_CREAT is not set, the result is undefined"
Right, it is undefined with respect to Posix, but for Linux O_EXCL on
a block device without O_CREAT is defined to bd_claim the block
device.

http://www.kernel.org/doc/man-pages/online/pages/man2/open.2.html

The second call to open_dev_excl is a bug, by definition you can't
exclusive open twice.  Can you reuse the fd established in
Grow_reshape?

--
Dan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help