aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 15:04:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 15:04:02 -0500
commitbac5e54c29f352d962a2447d22735316b347b9f1 (patch)
tree7642993fa93164835ffaa2dacd341388193f1979 /drivers
parent529e89430d6c0d64db8ac474cb95e68e2527c79a (diff)
parentc05c4edd876b7ae92787d1295868afcb89b6a348 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (38 commits) direct I/O fallback sync simplification ocfs: stop using do_sync_mapping_range cleanup blockdev_direct_IO locking make generic_acl slightly more generic sanitize xattr handler prototypes libfs: move EXPORT_SYMBOL for d_alloc_name vfs: force reval of target when following LAST_BIND symlinks (try #7) ima: limit imbalance msg Untangling ima mess, part 3: kill dead code in ima Untangling ima mess, part 2: deal with counters Untangling ima mess, part 1: alloc_file() O_TRUNC open shouldn't fail after file truncation ima: call ima_inode_free ima_inode_free IMA: clean up the IMA counts updating code ima: only insert at inode creation time ima: valid return code from ima_inode_alloc fs: move get_empty_filp() deffinition to internal.h Sanitize exec_permission_lite() Kill cached_lookup() and real_lookup() Kill path_lookup_open() ... Trivial conflicts in fs/direct-io.c
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/core/uverbs_main.c9
-rw-r--r--drivers/staging/dst/dcore.c46
2 files changed, 12 insertions, 43 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index aec0fbdfe7f0..5f284ffd430e 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -492,6 +492,7 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
492 int is_async, int *fd) 492 int is_async, int *fd)
493{ 493{
494 struct ib_uverbs_event_file *ev_file; 494 struct ib_uverbs_event_file *ev_file;
495 struct path path;
495 struct file *filp; 496 struct file *filp;
496 int ret; 497 int ret;
497 498
@@ -519,8 +520,10 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
519 * system call on a uverbs file, which will already have a 520 * system call on a uverbs file, which will already have a
520 * module reference. 521 * module reference.
521 */ 522 */
522 filp = alloc_file(uverbs_event_mnt, dget(uverbs_event_mnt->mnt_root), 523 path.mnt = uverbs_event_mnt;
523 FMODE_READ, fops_get(&uverbs_event_fops)); 524 path.dentry = uverbs_event_mnt->mnt_root;
525 path_get(&path);
526 filp = alloc_file(&path, FMODE_READ, fops_get(&uverbs_event_fops));
524 if (!filp) { 527 if (!filp) {
525 ret = -ENFILE; 528 ret = -ENFILE;
526 goto err_fd; 529 goto err_fd;
@@ -531,6 +534,8 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
531 return filp; 534 return filp;
532 535
533err_fd: 536err_fd:
537 fops_put(&uverbs_event_fops);
538 path_put(&path);
534 put_unused_fd(*fd); 539 put_unused_fd(*fd);
535 540
536err: 541err:
diff --git a/drivers/staging/dst/dcore.c b/drivers/staging/dst/dcore.c
index fd5bd0ea1e0d..c83ca7e3d048 100644
--- a/drivers/staging/dst/dcore.c
+++ b/drivers/staging/dst/dcore.c
@@ -403,7 +403,7 @@ static void dst_node_cleanup(struct dst_node *n)
403 403
404 if (n->bdev) { 404 if (n->bdev) {
405 sync_blockdev(n->bdev); 405 sync_blockdev(n->bdev);
406 blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE); 406 close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
407 } 407 }
408 408
409 dst_state_lock(st); 409 dst_state_lock(st);
@@ -464,37 +464,6 @@ void dst_node_put(struct dst_node *n)
464} 464}
465 465
466/* 466/*
467 * This function finds devices major/minor numbers for given pathname.
468 */
469static int dst_lookup_device(const char *path, dev_t *dev)
470{
471 int err;
472 struct nameidata nd;
473 struct inode *inode;
474
475 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
476 if (err)
477 return err;
478
479 inode = nd.path.dentry->d_inode;
480 if (!inode) {
481 err = -ENOENT;
482 goto out;
483 }
484
485 if (!S_ISBLK(inode->i_mode)) {
486 err = -ENOTBLK;
487 goto out;
488 }
489
490 *dev = inode->i_rdev;
491
492out:
493 path_put(&nd.path);
494 return err;
495}
496
497/*
498 * Setting up export device: lookup by the name, get its size 467 * Setting up export device: lookup by the name, get its size
499 * and setup listening socket, which will accept clients, which 468 * and setup listening socket, which will accept clients, which
500 * will submit IO for given storage. 469 * will submit IO for given storage.
@@ -503,17 +472,12 @@ static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
503 struct dst_export_ctl *le) 472 struct dst_export_ctl *le)
504{ 473{
505 int err; 474 int err;
506 dev_t dev = 0; /* gcc likes to scream here */
507 475
508 snprintf(n->info->local, sizeof(n->info->local), "%s", le->device); 476 snprintf(n->info->local, sizeof(n->info->local), "%s", le->device);
509 477
510 err = dst_lookup_device(le->device, &dev); 478 n->bdev = open_bdev_exclusive(le->device, FMODE_READ|FMODE_WRITE, NULL);
511 if (err) 479 if (IS_ERR(n->bdev))
512 return err; 480 return PTR_ERR(n->bdev);
513
514 n->bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE);
515 if (!n->bdev)
516 return -ENODEV;
517 481
518 if (n->size != 0) 482 if (n->size != 0)
519 n->size = min_t(loff_t, n->bdev->bd_inode->i_size, n->size); 483 n->size = min_t(loff_t, n->bdev->bd_inode->i_size, n->size);
@@ -528,7 +492,7 @@ static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
528 return 0; 492 return 0;
529 493
530err_out_cleanup: 494err_out_cleanup:
531 blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE); 495 close_bdev_exclusive(n->bdev, FMODE_READ|FMODE_WRITE);
532 n->bdev = NULL; 496 n->bdev = NULL;
533 497
534 return err; 498 return err;