diff options
Diffstat (limited to 'fs/fat/inode.c')
-rw-r--r-- | fs/fat/inode.c | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index d12cdf2a0406..19eafbe3c379 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -681,33 +681,24 @@ static struct dentry *fat_fh_to_dentry(struct super_block *sb, | |||
681 | inode = NULL; | 681 | inode = NULL; |
682 | } | 682 | } |
683 | } | 683 | } |
684 | if (!inode) { | ||
685 | /* For now, do nothing | ||
686 | * What we could do is: | ||
687 | * follow the file starting at fh[4], and record | ||
688 | * the ".." entry, and the name of the fh[2] entry. | ||
689 | * The follow the ".." file finding the next step up. | ||
690 | * This way we build a path to the root of | ||
691 | * the tree. If this works, we lookup the path and so | ||
692 | * get this inode into the cache. | ||
693 | * Finally try the fat_iget lookup again | ||
694 | * If that fails, then weare totally out of luck | ||
695 | * But all that is for another day | ||
696 | */ | ||
697 | } | ||
698 | if (!inode) | ||
699 | return ERR_PTR(-ESTALE); | ||
700 | |||
701 | 684 | ||
702 | /* now to find a dentry. | 685 | /* |
703 | * If possible, get a well-connected one | 686 | * For now, do nothing if the inode is not found. |
687 | * | ||
688 | * What we could do is: | ||
689 | * | ||
690 | * - follow the file starting at fh[4], and record the ".." entry, | ||
691 | * and the name of the fh[2] entry. | ||
692 | * - then follow the ".." file finding the next step up. | ||
693 | * | ||
694 | * This way we build a path to the root of the tree. If this works, we | ||
695 | * lookup the path and so get this inode into the cache. Finally try | ||
696 | * the fat_iget lookup again. If that fails, then we are totally out | ||
697 | * of luck. But all that is for another day | ||
704 | */ | 698 | */ |
705 | result = d_alloc_anon(inode); | 699 | result = d_obtain_alias(inode); |
706 | if (result == NULL) { | 700 | if (!IS_ERR(result)) |
707 | iput(inode); | 701 | result->d_op = sb->s_root->d_op; |
708 | return ERR_PTR(-ENOMEM); | ||
709 | } | ||
710 | result->d_op = sb->s_root->d_op; | ||
711 | return result; | 702 | return result; |
712 | } | 703 | } |
713 | 704 | ||
@@ -754,15 +745,8 @@ static struct dentry *fat_get_parent(struct dentry *child) | |||
754 | } | 745 | } |
755 | inode = fat_build_inode(sb, de, i_pos); | 746 | inode = fat_build_inode(sb, de, i_pos); |
756 | brelse(bh); | 747 | brelse(bh); |
757 | if (IS_ERR(inode)) { | 748 | |
758 | parent = ERR_CAST(inode); | 749 | parent = d_obtain_alias(inode); |
759 | goto out; | ||
760 | } | ||
761 | parent = d_alloc_anon(inode); | ||
762 | if (!parent) { | ||
763 | iput(inode); | ||
764 | parent = ERR_PTR(-ENOMEM); | ||
765 | } | ||
766 | out: | 750 | out: |
767 | unlock_super(sb); | 751 | unlock_super(sb); |
768 | 752 | ||