Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173821
b: refs/heads/master
c: cbba2fa
h: refs/heads/master
i:
  173819: 91b7bc9
v: v3
  • Loading branch information
Borislav Petkov authored and David S. Miller committed Oct 29, 2009
1 parent e6e26f6 commit d94a0c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3f911a6e6b9c6b485a33a680c4ae29d86d2f2a54
refs/heads/master: cbba2fa7b2c512135a5a946ccb112ddf0a1a1b1e
21 changes: 15 additions & 6 deletions trunk/drivers/ide/ide-tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ typedef struct ide_tape_obj {

static DEFINE_MUTEX(idetape_ref_mutex);

static DEFINE_MUTEX(idetape_chrdev_mutex);

static struct class *idetape_sysfs_class;

static void ide_tape_release(struct device *);
Expand Down Expand Up @@ -1457,10 +1459,11 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
if (i >= MAX_HWIFS * MAX_DRIVES)
return -ENXIO;

lock_kernel();
mutex_lock(&idetape_chrdev_mutex);

tape = ide_tape_get(NULL, true, i);
if (!tape) {
unlock_kernel();
mutex_unlock(&idetape_chrdev_mutex);
return -ENXIO;
}

Expand Down Expand Up @@ -1519,12 +1522,15 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
tape->door_locked = DOOR_LOCKED;
}
}
unlock_kernel();
mutex_unlock(&idetape_chrdev_mutex);

return 0;

out_put_tape:
ide_tape_put(tape);
unlock_kernel();

mutex_unlock(&idetape_chrdev_mutex);

return retval;
}

Expand All @@ -1551,7 +1557,8 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
ide_drive_t *drive = tape->drive;
unsigned int minor = iminor(inode);

lock_kernel();
mutex_lock(&idetape_chrdev_mutex);

tape = drive->driver_data;

ide_debug_log(IDE_DBG_FUNC, "enter");
Expand All @@ -1575,7 +1582,9 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
}
clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags);
ide_tape_put(tape);
unlock_kernel();

mutex_unlock(&idetape_chrdev_mutex);

return 0;
}

Expand Down

0 comments on commit d94a0c1

Please sign in to comment.