open_dev_excl: allow device to be read-only. devel-3.2
authorNeilBrown <neilb@suse.de>
Thu, 24 Mar 2011 03:21:58 +0000 (14:21 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 24 Mar 2011 03:21:58 +0000 (14:21 +1100)
commit7187750e8dfa7a93135a145e10c88569d4e7d767
tree243555a308b934cf40b68dab62f10f50b7e63f5a
parent972728bb1b9e28afe8dd8a0d6bd89fb3f7b65f2b
open_dev_excl: allow device to be read-only.

For many operations we don't need a writable device.  So if
opening O_RDWR fails in open_dev_excl, then try again O_RDONLY.

If we really needed write, a subsequent operation will failed.  But
if we didn't, we succeed when otherwise we wouldn't have.

Signed-off-by: NeilBrown <neilb@suse.de>
util.c