diff options
author | Jeff Liu <jeff.liu@oracle.com> | 2013-04-29 18:05:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:54:27 -0400 |
commit | b3e0767abcd6eda32cdfd9c6a6b9e53b4ddf6d4d (patch) | |
tree | f8ced4971ffc171d60820a6267b80f38d5b26fac /fs/ocfs2/ioctl.c | |
parent | 18ff44b189e2a9becb2047a790578b90aef56349 (diff) |
ocfs2: delay inode update transactions after verifying the input flags
There is no need to start the inode update transactions before/while
verifying the input flags. As a refinement, this patch delay the
transactions utill the pre-check up is ok.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Acked-by: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/ioctl.c')
-rw-r--r-- | fs/ocfs2/ioctl.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 752f0b26221d..6cab301a568d 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -101,13 +101,6 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
101 | if (!S_ISDIR(inode->i_mode)) | 101 | if (!S_ISDIR(inode->i_mode)) |
102 | flags &= ~OCFS2_DIRSYNC_FL; | 102 | flags &= ~OCFS2_DIRSYNC_FL; |
103 | 103 | ||
104 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | ||
105 | if (IS_ERR(handle)) { | ||
106 | status = PTR_ERR(handle); | ||
107 | mlog_errno(status); | ||
108 | goto bail_unlock; | ||
109 | } | ||
110 | |||
111 | oldflags = ocfs2_inode->ip_attr; | 104 | oldflags = ocfs2_inode->ip_attr; |
112 | flags = flags & mask; | 105 | flags = flags & mask; |
113 | flags |= oldflags & ~mask; | 106 | flags |= oldflags & ~mask; |
@@ -120,7 +113,14 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
120 | if ((oldflags & OCFS2_IMMUTABLE_FL) || ((flags ^ oldflags) & | 113 | if ((oldflags & OCFS2_IMMUTABLE_FL) || ((flags ^ oldflags) & |
121 | (OCFS2_APPEND_FL | OCFS2_IMMUTABLE_FL))) { | 114 | (OCFS2_APPEND_FL | OCFS2_IMMUTABLE_FL))) { |
122 | if (!capable(CAP_LINUX_IMMUTABLE)) | 115 | if (!capable(CAP_LINUX_IMMUTABLE)) |
123 | goto bail_commit; | 116 | goto bail_unlock; |
117 | } | ||
118 | |||
119 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | ||
120 | if (IS_ERR(handle)) { | ||
121 | status = PTR_ERR(handle); | ||
122 | mlog_errno(status); | ||
123 | goto bail_unlock; | ||
124 | } | 124 | } |
125 | 125 | ||
126 | ocfs2_inode->ip_attr = flags; | 126 | ocfs2_inode->ip_attr = flags; |
@@ -130,8 +130,8 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
130 | if (status < 0) | 130 | if (status < 0) |
131 | mlog_errno(status); | 131 | mlog_errno(status); |
132 | 132 | ||
133 | bail_commit: | ||
134 | ocfs2_commit_trans(osb, handle); | 133 | ocfs2_commit_trans(osb, handle); |
134 | |||
135 | bail_unlock: | 135 | bail_unlock: |
136 | ocfs2_inode_unlock(inode, 1); | 136 | ocfs2_inode_unlock(inode, 1); |
137 | bail: | 137 | bail: |