diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 0b5fa124bef2..ef941f99b2bc 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -542,50 +542,26 @@ xfs_vn_follow_link( | |||
542 | struct dentry *dentry, | 542 | struct dentry *dentry, |
543 | struct nameidata *nd) | 543 | struct nameidata *nd) |
544 | { | 544 | { |
545 | bhv_vnode_t *vp; | 545 | bhv_vnode_t *vp = vn_from_inode(dentry->d_inode); |
546 | uio_t *uio; | ||
547 | iovec_t iov; | ||
548 | int error; | ||
549 | char *link; | 546 | char *link; |
550 | 547 | int error = -ENOMEM; | |
551 | ASSERT(dentry); | ||
552 | ASSERT(nd); | ||
553 | 548 | ||
554 | link = kmalloc(MAXPATHLEN+1, GFP_KERNEL); | 549 | link = kmalloc(MAXPATHLEN+1, GFP_KERNEL); |
555 | if (!link) { | 550 | if (!link) |
556 | nd_set_link(nd, ERR_PTR(-ENOMEM)); | 551 | goto out_err; |
557 | return NULL; | ||
558 | } | ||
559 | |||
560 | uio = kmalloc(sizeof(uio_t), GFP_KERNEL); | ||
561 | if (!uio) { | ||
562 | kfree(link); | ||
563 | nd_set_link(nd, ERR_PTR(-ENOMEM)); | ||
564 | return NULL; | ||
565 | } | ||
566 | |||
567 | vp = vn_from_inode(dentry->d_inode); | ||
568 | 552 | ||
569 | iov.iov_base = link; | 553 | error = -bhv_vop_readlink(vp, link); |
570 | iov.iov_len = MAXPATHLEN; | 554 | if (unlikely(error)) |
571 | 555 | goto out_kfree; | |
572 | uio->uio_iov = &iov; | ||
573 | uio->uio_offset = 0; | ||
574 | uio->uio_segflg = UIO_SYSSPACE; | ||
575 | uio->uio_resid = MAXPATHLEN; | ||
576 | uio->uio_iovcnt = 1; | ||
577 | |||
578 | error = bhv_vop_readlink(vp, uio, 0, NULL); | ||
579 | if (unlikely(error)) { | ||
580 | kfree(link); | ||
581 | link = ERR_PTR(-error); | ||
582 | } else { | ||
583 | link[MAXPATHLEN - uio->uio_resid] = '\0'; | ||
584 | } | ||
585 | kfree(uio); | ||
586 | 556 | ||
587 | nd_set_link(nd, link); | 557 | nd_set_link(nd, link); |
588 | return NULL; | 558 | return NULL; |
559 | |||
560 | out_kfree: | ||
561 | kfree(link); | ||
562 | out_err: | ||
563 | nd_set_link(nd, ERR_PTR(error)); | ||
564 | return NULL; | ||
589 | } | 565 | } |
590 | 566 | ||
591 | STATIC void | 567 | STATIC void |