patch-2.2.2 linux/fs/open.c

Next file: linux/fs/smbfs/file.c
Previous file: linux/fs/nfsd/vfs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.1/linux/fs/open.c linux/fs/open.c
@@ -22,10 +22,11 @@
 	error = PTR_ERR(dentry);
 	if (!IS_ERR(dentry)) {
 		struct inode * inode = dentry->d_inode;
+		struct super_block * sb = inode->i_sb;
 
-		error = -ENOSYS;
-		if (inode->i_sb->s_op->statfs)
-			error = inode->i_sb->s_op->statfs(inode->i_sb, buf, sizeof(struct statfs));
+		error = -ENODEV;
+		if (sb && sb->s_op && sb->s_op->statfs)
+			error = sb->s_op->statfs(sb, buf, sizeof(struct statfs));
 
 		dput(dentry);
 	}
@@ -52,10 +53,8 @@
 	if (!(inode = dentry->d_inode))
 		goto out_putf;
 	error = -ENODEV;
-	if (!(sb = inode->i_sb))
-		goto out_putf;
-	error = -ENOSYS;
-	if (sb->s_op->statfs)
+	sb = inode->i_sb;
+	if (sb && sb->s_op && sb->s_op->statfs)
 		error = sb->s_op->statfs(sb, buf, sizeof(struct statfs));
 out_putf:
 	fput(file);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)