mirror of https://github.com/schoebel/mars
if: disallow open when busy
This commit is contained in:
parent
89f39cae07
commit
3aaeb73dfc
|
@ -1338,6 +1338,13 @@ static int if_open(struct block_device *bdev, fmode_t mode)
|
|||
return -ESHUTDOWN;
|
||||
}
|
||||
|
||||
if (brick->busy_open) {
|
||||
MARS_INF("----------------------- BUSY %d ------------------------------\n",
|
||||
atomic_read(&brick->open_count));
|
||||
up(&brick->switch_sem);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
if (brick->open_epoch && !atomic_read(&brick->open_count))
|
||||
get_lamport(NULL, brick->open_epoch);
|
||||
atomic_inc(&brick->open_count);
|
||||
|
|
|
@ -112,6 +112,7 @@ struct if_brick {
|
|||
int readahead;
|
||||
bool skip_sync;
|
||||
bool shutdown;
|
||||
bool busy_open;
|
||||
// inspectable
|
||||
struct lamport_time *open_epoch;
|
||||
atomic_t open_count;
|
||||
|
|
Loading…
Reference in New Issue