if: disallow open when busy

This commit is contained in:
Thomas Schoebel-Theuer 2021-01-06 09:40:25 +01:00 committed by Thomas Schoebel-Theuer
parent 89f39cae07
commit 3aaeb73dfc
2 changed files with 8 additions and 0 deletions

View File

@ -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);

View File

@ -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;