bio: fix wrong detection of error

This commit is contained in:
Thomas Schoebel-Theuer 2013-01-17 17:33:51 +01:00
parent 9d491ae27c
commit c7f8d856ee
1 changed files with 4 additions and 3 deletions

View File

@ -663,9 +663,10 @@ static int bio_switch(struct bio_brick *brick)
brick->filp = filp_open(path, flags, prot);
set_fs(oldfs);
if (!brick->filp) {
MARS_ERR("cannot open '%s'\n", path);
status = -ENOENT;
if (unlikely(!brick->filp || IS_ERR(brick->filp))) {
status = PTR_ERR(brick->filp);
brick->filp = NULL;
MARS_ERR("cannot open '%s', status = %d\n", path, status);
goto done;
}