aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-23 13:22:40 -0400
commit5ed487bc2c44ca4e9668ef9cb54c830e2a9fac47 (patch)
treeaf19ed28db83e8f52690872ac99336da1cf2fd3b /fs/fat
parent5b34653963de7a6d0d8c783527457d68fddc60fb (diff)
parentfd217f4d70172c526478f2bc76859e909fdfa674 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (46 commits) [PATCH] fs: add a sanity check in d_free [PATCH] i_version: remount support [patch] vfs: make security_inode_setattr() calling consistent [patch 1/3] FS_MBCACHE: don't needlessly make it built-in [PATCH] move executable checking into ->permission() [PATCH] fs/dcache.c: update comment of d_validate() [RFC PATCH] touch_mnt_namespace when the mount flags change [PATCH] reiserfs: add missing llseek method [PATCH] fix ->llseek for more directories [PATCH vfs-2.6 6/6] vfs: add LOOKUP_RENAME_TARGET intent [PATCH vfs-2.6 5/6] vfs: remove LOOKUP_PARENT from non LOOKUP_PARENT lookup [PATCH vfs-2.6 4/6] vfs: remove unnecessary fsnotify_d_instantiate() [PATCH vfs-2.6 3/6] vfs: add __d_instantiate() helper [PATCH vfs-2.6 2/6] vfs: add d_ancestor() [PATCH vfs-2.6 1/6] vfs: replace parent == dentry->d_parent by IS_ROOT() [PATCH] get rid of on-stack dentry in udf [PATCH 2/2] anondev: switch to IDA [PATCH 1/2] anondev: init IDR statically [JFFS2] Use d_splice_alias() not d_add() in jffs2_lookup() [PATCH] Optimise NFS readdir hack slightly. ...
Diffstat (limited to 'fs/fat')
-rw-r--r--fs/fat/dir.c1
-rw-r--r--fs/fat/inode.c52
2 files changed, 19 insertions, 34 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index cd4a0162e10d..bae1c3292522 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -839,6 +839,7 @@ const struct file_operations fat_dir_operations = {
839 .compat_ioctl = fat_compat_dir_ioctl, 839 .compat_ioctl = fat_compat_dir_ioctl,
840#endif 840#endif
841 .fsync = file_fsync, 841 .fsync = file_fsync,
842 .llseek = generic_file_llseek,
842}; 843};
843 844
844static int fat_get_short_entry(struct inode *dir, loff_t *pos, 845static int fat_get_short_entry(struct inode *dir, loff_t *pos,
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 }
766out: 750out:
767 unlock_super(sb); 751 unlock_super(sb);
768 752