VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: David P. Quigley <dpquigl@tycho.nsa.gov> 2008-02-04 22:29:40 -0800 committer: Linus Torvalds <torvalds@woody.linux-foundation.org> 2008-02-05 09:44:20 -0800 commit: 4bea58053f206be9a89ca35850f9ad295dac2042 parent: 42492594043d621a7910ff5877c3eb9202870b45
Commit Summary:
VFS: Reorder vfs_getxattr to avoid unnecessary calls to the LSM
Diffstat:
1 file changed, 8 insertions, 7 deletions
diff --git a/fs/xattr.c b/fs/xattr.c
index 1858552a6a1a..f7c8f87bb390 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -145,11 +145,6 @@ vfs_getxattr(struct dentry *dentry, char *name, void *value, size_t size)
 	if (error)
 		return error;
 
-	if (inode->i_op->getxattr)
-		error = inode->i_op->getxattr(dentry, name, value, size);
-	else
-		error = -EOPNOTSUPP;
-
 	if (!strncmp(name, XATTR_SECURITY_PREFIX,
 				XATTR_SECURITY_PREFIX_LEN)) {
 		const char *suffix = name + XATTR_SECURITY_PREFIX_LEN;
@@ -158,9 +153,15 @@ vfs_getxattr(struct dentry *dentry, char *name, void *value, size_t size)
 		 * Only overwrite the return value if a security module
 		 * is actually active.
 		 */
-		if (ret != -EOPNOTSUPP)
-			error = ret;
+		if (ret == -EOPNOTSUPP)
+			goto nolsm;
+		return ret;
 	}
+nolsm:
+	if (inode->i_op->getxattr)
+		error = inode->i_op->getxattr(dentry, name, value, size);
+	else
+		error = -EOPNOTSUPP;
 
 	return error;
 }