lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1345282974-7603-1-git-send-email-linkinjeon@gmail.com>
Date:	Sat, 18 Aug 2012 05:42:54 -0400
From:	Namjae Jeon <linkinjeon@...il.com>
To:	hirofumi@...l.parknet.co.jp, akpm@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org, Namjae Jeon <linkinjeon@...il.com>,
	Namjae Jeon <namjae.jeon@...sung.com>,
	Ravishankar N <ravi.n1@...sung.com>,
	Amit Sahrawat <a.sahrawat@...sung.com>
Subject: [PATCH 2/4] fat (exportfs): rebuild inode if ilookup() fails

From: Namjae Jeon <namjae.jeon@...sung.com>

Since the previous patch in this patch-set uses i_pos as the inode
number, we can use it to find the directory entry of the inode and
subsequently rebuild the inode if the cache lookups fail.

Since this involves  accessing the FAT media,it is better to do this
only if the 'nfs' mount option is enabled.

Signed-off-by: Namjae Jeon <namjae.jeon@...sung.com>
Signed-off-by: Ravishankar N <ravi.n1@...sung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@...sung.com>
---
 fs/fat/nfs.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c
index ef4b5fa..44678e4 100644
--- a/fs/fat/nfs.c
+++ b/fs/fat/nfs.c
@@ -52,6 +52,24 @@ static struct inode *fat_nfs_get_inode(struct super_block *sb,
 		iput(inode);
 		inode = NULL;
 	}
+	if (inode == NULL && MSDOS_SB(sb)->options.nfs) {
+		struct buffer_head *bh = NULL;
+		struct msdos_dir_entry *de ;
+		loff_t i_pos = (loff_t)ino;
+		int bits = MSDOS_SB(sb)->dir_per_block_bits;
+		loff_t blocknr = i_pos >> bits;
+		bh = sb_bread(sb, blocknr);
+		if (!bh) {
+			fat_msg(sb, KERN_ERR,
+				"unable to read block(%llu) for building NFS inode",
+				(llu)blocknr);
+			return inode;
+		}
+		de = (struct msdos_dir_entry *)bh->b_data;
+		inode = fat_build_inode(sb, &de[i_pos&((1<<bits)-1)],
+					i_pos);
+		brelse(bh);
+	}
 
 	return inode;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ