diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-04-22 03:34:06 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-29 01:54:12 -0400 |
commit | cfa853e47df4fbee441ac0ac3fb592f076233145 (patch) | |
tree | 7e4baafba5ee0f05561580c301c5d360236063f3 | |
parent | 579aa9caf552c639fc78168db4cfe7ffcf00c3b3 (diff) |
[XFS] remove manual lookup from xfs_rename and simplify locking
->rename already gets the target inode passed if it exits. Pass it down to
xfs_rename so that we can avoid looking it up again. Also simplify locking
as the first lock section in xfs_rename can go away now: the isdir is an
invariant over the lifetime of the inode, and new_parent and the nlink
check are namespace topology protected by i_mutex in the VFS. The projid
check needs to move into the second lock section anyway to not be racy.
Also kill the now unused xfs_dir_lookup_int and remove the now-unused
first_locked argumet to xfs_lock_inodes.
SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30903a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_dfrag.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_rename.c | 185 | ||||
-rw-r--r-- | fs/xfs/xfs_utils.c | 43 | ||||
-rw-r--r-- | fs/xfs/xfs_utils.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 14 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.h | 2 |
8 files changed, 55 insertions, 200 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index a1237dad6430..2bf287ef5489 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -511,7 +511,8 @@ xfs_vn_rename( | |||
511 | xfs_dentry_to_name(&nname, ndentry); | 511 | xfs_dentry_to_name(&nname, ndentry); |
512 | 512 | ||
513 | error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), | 513 | error = xfs_rename(XFS_I(odir), &oname, XFS_I(odentry->d_inode), |
514 | XFS_I(ndir), &nname); | 514 | XFS_I(ndir), &nname, new_inode ? |
515 | XFS_I(new_inode) : NULL); | ||
515 | if (likely(!error)) { | 516 | if (likely(!error)) { |
516 | if (new_inode) | 517 | if (new_inode) |
517 | xfs_validate_fields(new_inode); | 518 | xfs_validate_fields(new_inode); |
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index 3f53fad356a3..5f3647cb9885 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c | |||
@@ -162,7 +162,7 @@ xfs_swap_extents( | |||
162 | ips[1] = ip; | 162 | ips[1] = ip; |
163 | } | 163 | } |
164 | 164 | ||
165 | xfs_lock_inodes(ips, 2, 0, lock_flags); | 165 | xfs_lock_inodes(ips, 2, lock_flags); |
166 | locked = 1; | 166 | locked = 1; |
167 | 167 | ||
168 | /* Verify that both files have the same format */ | 168 | /* Verify that both files have the same format */ |
@@ -265,7 +265,7 @@ xfs_swap_extents( | |||
265 | locked = 0; | 265 | locked = 0; |
266 | goto error0; | 266 | goto error0; |
267 | } | 267 | } |
268 | xfs_lock_inodes(ips, 2, 0, XFS_ILOCK_EXCL); | 268 | xfs_lock_inodes(ips, 2, XFS_ILOCK_EXCL); |
269 | 269 | ||
270 | /* | 270 | /* |
271 | * Count the number of extended attribute blocks | 271 | * Count the number of extended attribute blocks |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 877d71adbc1e..0a999fee4f03 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -524,7 +524,7 @@ int xfs_iflush(xfs_inode_t *, uint); | |||
524 | void xfs_iflush_all(struct xfs_mount *); | 524 | void xfs_iflush_all(struct xfs_mount *); |
525 | void xfs_ichgtime(xfs_inode_t *, int); | 525 | void xfs_ichgtime(xfs_inode_t *, int); |
526 | xfs_fsize_t xfs_file_last_byte(xfs_inode_t *); | 526 | xfs_fsize_t xfs_file_last_byte(xfs_inode_t *); |
527 | void xfs_lock_inodes(xfs_inode_t **, int, int, uint); | 527 | void xfs_lock_inodes(xfs_inode_t **, int, uint); |
528 | 528 | ||
529 | void xfs_synchronize_atime(xfs_inode_t *); | 529 | void xfs_synchronize_atime(xfs_inode_t *); |
530 | void xfs_mark_inode_dirty_sync(xfs_inode_t *); | 530 | void xfs_mark_inode_dirty_sync(xfs_inode_t *); |
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index ee371890d85d..6a141427f68a 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -55,85 +55,32 @@ xfs_rename_unlock4( | |||
55 | 55 | ||
56 | xfs_iunlock(i_tab[0], lock_mode); | 56 | xfs_iunlock(i_tab[0], lock_mode); |
57 | for (i = 1; i < 4; i++) { | 57 | for (i = 1; i < 4; i++) { |
58 | if (i_tab[i] == NULL) { | 58 | if (i_tab[i] == NULL) |
59 | break; | 59 | break; |
60 | } | 60 | |
61 | /* | 61 | /* |
62 | * Watch out for duplicate entries in the table. | 62 | * Watch out for duplicate entries in the table. |
63 | */ | 63 | */ |
64 | if (i_tab[i] != i_tab[i-1]) { | 64 | if (i_tab[i] != i_tab[i-1]) |
65 | xfs_iunlock(i_tab[i], lock_mode); | 65 | xfs_iunlock(i_tab[i], lock_mode); |
66 | } | ||
67 | } | 66 | } |
68 | } | 67 | } |
69 | 68 | ||
70 | #ifdef DEBUG | ||
71 | int xfs_rename_skip, xfs_rename_nskip; | ||
72 | #endif | ||
73 | |||
74 | /* | 69 | /* |
75 | * The following routine will acquire the locks required for a rename | 70 | * Enter all inodes for a rename transaction into a sorted array. |
76 | * operation. The code understands the semantics of renames and will | ||
77 | * validate that name1 exists under dp1 & that name2 may or may not | ||
78 | * exist under dp2. | ||
79 | * | ||
80 | * We are renaming dp1/name1 to dp2/name2. | ||
81 | * | ||
82 | * Return ENOENT if dp1 does not exist, other lookup errors, or 0 for success. | ||
83 | */ | 71 | */ |
84 | STATIC int | 72 | STATIC void |
85 | xfs_lock_for_rename( | 73 | xfs_sort_for_rename( |
86 | xfs_inode_t *dp1, /* in: old (source) directory inode */ | 74 | xfs_inode_t *dp1, /* in: old (source) directory inode */ |
87 | xfs_inode_t *dp2, /* in: new (target) directory inode */ | 75 | xfs_inode_t *dp2, /* in: new (target) directory inode */ |
88 | xfs_inode_t *ip1, /* in: inode of old entry */ | 76 | xfs_inode_t *ip1, /* in: inode of old entry */ |
89 | struct xfs_name *name2, /* in: new entry name */ | 77 | xfs_inode_t *ip2, /* in: inode of new entry, if it |
90 | xfs_inode_t **ipp2, /* out: inode of new entry, if it | ||
91 | already exists, NULL otherwise. */ | 78 | already exists, NULL otherwise. */ |
92 | xfs_inode_t **i_tab,/* out: array of inode returned, sorted */ | 79 | xfs_inode_t **i_tab,/* out: array of inode returned, sorted */ |
93 | int *num_inodes) /* out: number of inodes in array */ | 80 | int *num_inodes) /* out: number of inodes in array */ |
94 | { | 81 | { |
95 | xfs_inode_t *ip2 = NULL; | ||
96 | xfs_inode_t *temp; | 82 | xfs_inode_t *temp; |
97 | xfs_ino_t inum1, inum2; | ||
98 | int error; | ||
99 | int i, j; | 83 | int i, j; |
100 | uint lock_mode; | ||
101 | int diff_dirs = (dp1 != dp2); | ||
102 | |||
103 | /* | ||
104 | * First, find out the current inums of the entries so that we | ||
105 | * can determine the initial locking order. We'll have to | ||
106 | * sanity check stuff after all the locks have been acquired | ||
107 | * to see if we still have the right inodes, directories, etc. | ||
108 | */ | ||
109 | lock_mode = xfs_ilock_map_shared(dp1); | ||
110 | IHOLD(ip1); | ||
111 | xfs_itrace_ref(ip1); | ||
112 | |||
113 | inum1 = ip1->i_ino; | ||
114 | |||
115 | /* | ||
116 | * Unlock dp1 and lock dp2 if they are different. | ||
117 | */ | ||
118 | if (diff_dirs) { | ||
119 | xfs_iunlock_map_shared(dp1, lock_mode); | ||
120 | lock_mode = xfs_ilock_map_shared(dp2); | ||
121 | } | ||
122 | |||
123 | error = xfs_dir_lookup_int(dp2, lock_mode, name2, &inum2, &ip2); | ||
124 | if (error == ENOENT) { /* target does not need to exist. */ | ||
125 | inum2 = 0; | ||
126 | } else if (error) { | ||
127 | /* | ||
128 | * If dp2 and dp1 are the same, the next line unlocks dp1. | ||
129 | * Got it? | ||
130 | */ | ||
131 | xfs_iunlock_map_shared(dp2, lock_mode); | ||
132 | IRELE (ip1); | ||
133 | return error; | ||
134 | } else { | ||
135 | xfs_itrace_ref(ip2); | ||
136 | } | ||
137 | 84 | ||
138 | /* | 85 | /* |
139 | * i_tab contains a list of pointers to inodes. We initialize | 86 | * i_tab contains a list of pointers to inodes. We initialize |
@@ -145,21 +92,20 @@ xfs_lock_for_rename( | |||
145 | i_tab[0] = dp1; | 92 | i_tab[0] = dp1; |
146 | i_tab[1] = dp2; | 93 | i_tab[1] = dp2; |
147 | i_tab[2] = ip1; | 94 | i_tab[2] = ip1; |
148 | if (inum2 == 0) { | 95 | if (ip2) { |
149 | *num_inodes = 3; | ||
150 | i_tab[3] = NULL; | ||
151 | } else { | ||
152 | *num_inodes = 4; | 96 | *num_inodes = 4; |
153 | i_tab[3] = ip2; | 97 | i_tab[3] = ip2; |
98 | } else { | ||
99 | *num_inodes = 3; | ||
100 | i_tab[3] = NULL; | ||
154 | } | 101 | } |
155 | *ipp2 = i_tab[3]; | ||
156 | 102 | ||
157 | /* | 103 | /* |
158 | * Sort the elements via bubble sort. (Remember, there are at | 104 | * Sort the elements via bubble sort. (Remember, there are at |
159 | * most 4 elements to sort, so this is adequate.) | 105 | * most 4 elements to sort, so this is adequate.) |
160 | */ | 106 | */ |
161 | for (i=0; i < *num_inodes; i++) { | 107 | for (i = 0; i < *num_inodes; i++) { |
162 | for (j=1; j < *num_inodes; j++) { | 108 | for (j = 1; j < *num_inodes; j++) { |
163 | if (i_tab[j]->i_ino < i_tab[j-1]->i_ino) { | 109 | if (i_tab[j]->i_ino < i_tab[j-1]->i_ino) { |
164 | temp = i_tab[j]; | 110 | temp = i_tab[j]; |
165 | i_tab[j] = i_tab[j-1]; | 111 | i_tab[j] = i_tab[j-1]; |
@@ -167,30 +113,6 @@ xfs_lock_for_rename( | |||
167 | } | 113 | } |
168 | } | 114 | } |
169 | } | 115 | } |
170 | |||
171 | /* | ||
172 | * We have dp2 locked. If it isn't first, unlock it. | ||
173 | * If it is first, tell xfs_lock_inodes so it can skip it | ||
174 | * when locking. if dp1 == dp2, xfs_lock_inodes will skip both | ||
175 | * since they are equal. xfs_lock_inodes needs all these inodes | ||
176 | * so that it can unlock and retry if there might be a dead-lock | ||
177 | * potential with the log. | ||
178 | */ | ||
179 | |||
180 | if (i_tab[0] == dp2 && lock_mode == XFS_ILOCK_SHARED) { | ||
181 | #ifdef DEBUG | ||
182 | xfs_rename_skip++; | ||
183 | #endif | ||
184 | xfs_lock_inodes(i_tab, *num_inodes, 1, XFS_ILOCK_SHARED); | ||
185 | } else { | ||
186 | #ifdef DEBUG | ||
187 | xfs_rename_nskip++; | ||
188 | #endif | ||
189 | xfs_iunlock_map_shared(dp2, lock_mode); | ||
190 | xfs_lock_inodes(i_tab, *num_inodes, 0, XFS_ILOCK_SHARED); | ||
191 | } | ||
192 | |||
193 | return 0; | ||
194 | } | 116 | } |
195 | 117 | ||
196 | /* | 118 | /* |
@@ -202,10 +124,10 @@ xfs_rename( | |||
202 | struct xfs_name *src_name, | 124 | struct xfs_name *src_name, |
203 | xfs_inode_t *src_ip, | 125 | xfs_inode_t *src_ip, |
204 | xfs_inode_t *target_dp, | 126 | xfs_inode_t *target_dp, |
205 | struct xfs_name *target_name) | 127 | struct xfs_name *target_name, |
128 | xfs_inode_t *target_ip) | ||
206 | { | 129 | { |
207 | xfs_trans_t *tp; | 130 | xfs_trans_t *tp = NULL; |
208 | xfs_inode_t *target_ip; | ||
209 | xfs_mount_t *mp = src_dp->i_mount; | 131 | xfs_mount_t *mp = src_dp->i_mount; |
210 | int new_parent; /* moving to a new dir */ | 132 | int new_parent; /* moving to a new dir */ |
211 | int src_is_directory; /* src_name is a directory */ | 133 | int src_is_directory; /* src_name is a directory */ |
@@ -230,64 +152,31 @@ xfs_rename( | |||
230 | target_dp, DM_RIGHT_NULL, | 152 | target_dp, DM_RIGHT_NULL, |
231 | src_name->name, target_name->name, | 153 | src_name->name, target_name->name, |
232 | 0, 0, 0); | 154 | 0, 0, 0); |
233 | if (error) { | 155 | if (error) |
234 | return error; | 156 | return error; |
235 | } | ||
236 | } | 157 | } |
237 | /* Return through std_return after this point. */ | 158 | /* Return through std_return after this point. */ |
238 | 159 | ||
239 | /* | 160 | new_parent = (src_dp != target_dp); |
240 | * Lock all the participating inodes. Depending upon whether | 161 | src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); |
241 | * the target_name exists in the target directory, and | ||
242 | * whether the target directory is the same as the source | ||
243 | * directory, we can lock from 2 to 4 inodes. | ||
244 | * xfs_lock_for_rename() will return ENOENT if src_name | ||
245 | * does not exist in the source directory. | ||
246 | */ | ||
247 | tp = NULL; | ||
248 | error = xfs_lock_for_rename(src_dp, target_dp, src_ip, target_name, | ||
249 | &target_ip, inodes, &num_inodes); | ||
250 | if (error) { | ||
251 | /* | ||
252 | * We have nothing locked, no inode references, and | ||
253 | * no transaction, so just get out. | ||
254 | */ | ||
255 | goto std_return; | ||
256 | } | ||
257 | |||
258 | ASSERT(src_ip != NULL); | ||
259 | 162 | ||
260 | if ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR) { | 163 | if (src_is_directory) { |
261 | /* | 164 | /* |
262 | * Check for link count overflow on target_dp | 165 | * Check for link count overflow on target_dp |
263 | */ | 166 | */ |
264 | if (target_ip == NULL && (src_dp != target_dp) && | 167 | if (target_ip == NULL && new_parent && |
265 | target_dp->i_d.di_nlink >= XFS_MAXLINK) { | 168 | target_dp->i_d.di_nlink >= XFS_MAXLINK) { |
266 | error = XFS_ERROR(EMLINK); | 169 | error = XFS_ERROR(EMLINK); |
267 | xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); | 170 | goto std_return; |
268 | goto rele_return; | ||
269 | } | 171 | } |
270 | } | 172 | } |
271 | 173 | ||
272 | /* | 174 | xfs_sort_for_rename(src_dp, target_dp, src_ip, target_ip, |
273 | * If we are using project inheritance, we only allow renames | 175 | inodes, &num_inodes); |
274 | * into our tree when the project IDs are the same; else the | ||
275 | * tree quota mechanism would be circumvented. | ||
276 | */ | ||
277 | if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && | ||
278 | (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) { | ||
279 | error = XFS_ERROR(EXDEV); | ||
280 | xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); | ||
281 | goto rele_return; | ||
282 | } | ||
283 | |||
284 | new_parent = (src_dp != target_dp); | ||
285 | src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); | ||
286 | 176 | ||
287 | /* | 177 | IHOLD(src_ip); |
288 | * Drop the locks on our inodes so that we can start the transaction. | 178 | if (target_ip) |
289 | */ | 179 | IHOLD(target_ip); |
290 | xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); | ||
291 | 180 | ||
292 | XFS_BMAP_INIT(&free_list, &first_block); | 181 | XFS_BMAP_INIT(&free_list, &first_block); |
293 | tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME); | 182 | tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME); |
@@ -314,9 +203,25 @@ xfs_rename( | |||
314 | } | 203 | } |
315 | 204 | ||
316 | /* | 205 | /* |
317 | * Reacquire the inode locks we dropped above. | 206 | * Lock all the participating inodes. Depending upon whether |
207 | * the target_name exists in the target directory, and | ||
208 | * whether the target directory is the same as the source | ||
209 | * directory, we can lock from 2 to 4 inodes. | ||
318 | */ | 210 | */ |
319 | xfs_lock_inodes(inodes, num_inodes, 0, XFS_ILOCK_EXCL); | 211 | xfs_lock_inodes(inodes, num_inodes, XFS_ILOCK_EXCL); |
212 | |||
213 | /* | ||
214 | * If we are using project inheritance, we only allow renames | ||
215 | * into our tree when the project IDs are the same; else the | ||
216 | * tree quota mechanism would be circumvented. | ||
217 | */ | ||
218 | if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && | ||
219 | (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) { | ||
220 | error = XFS_ERROR(EXDEV); | ||
221 | xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); | ||
222 | xfs_trans_cancel(tp, cancel_flags); | ||
223 | goto rele_return; | ||
224 | } | ||
320 | 225 | ||
321 | /* | 226 | /* |
322 | * Join all the inodes to the transaction. From this point on, | 227 | * Join all the inodes to the transaction. From this point on, |
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c index 27075c9060ef..98e5f110ba5f 100644 --- a/fs/xfs/xfs_utils.c +++ b/fs/xfs/xfs_utils.c | |||
@@ -41,49 +41,6 @@ | |||
41 | #include "xfs_utils.h" | 41 | #include "xfs_utils.h" |
42 | 42 | ||
43 | 43 | ||
44 | int | ||
45 | xfs_dir_lookup_int( | ||
46 | xfs_inode_t *dp, | ||
47 | uint lock_mode, | ||
48 | struct xfs_name *name, | ||
49 | xfs_ino_t *inum, | ||
50 | xfs_inode_t **ipp) | ||
51 | { | ||
52 | int error; | ||
53 | |||
54 | xfs_itrace_entry(dp); | ||
55 | |||
56 | error = xfs_dir_lookup(NULL, dp, name, inum); | ||
57 | if (!error) { | ||
58 | /* | ||
59 | * Unlock the directory. We do this because we can't | ||
60 | * hold the directory lock while doing the vn_get() | ||
61 | * in xfs_iget(). Doing so could cause us to hold | ||
62 | * a lock while waiting for the inode to finish | ||
63 | * being inactive while it's waiting for a log | ||
64 | * reservation in the inactive routine. | ||
65 | */ | ||
66 | xfs_iunlock(dp, lock_mode); | ||
67 | error = xfs_iget(dp->i_mount, NULL, *inum, 0, 0, ipp, 0); | ||
68 | xfs_ilock(dp, lock_mode); | ||
69 | |||
70 | if (error) { | ||
71 | *ipp = NULL; | ||
72 | } else if ((*ipp)->i_d.di_mode == 0) { | ||
73 | /* | ||
74 | * The inode has been freed. Something is | ||
75 | * wrong so just get out of here. | ||
76 | */ | ||
77 | xfs_iunlock(dp, lock_mode); | ||
78 | xfs_iput_new(*ipp, 0); | ||
79 | *ipp = NULL; | ||
80 | xfs_ilock(dp, lock_mode); | ||
81 | error = XFS_ERROR(ENOENT); | ||
82 | } | ||
83 | } | ||
84 | return error; | ||
85 | } | ||
86 | |||
87 | /* | 44 | /* |
88 | * Allocates a new inode from disk and return a pointer to the | 45 | * Allocates a new inode from disk and return a pointer to the |
89 | * incore copy. This routine will internally commit the current | 46 | * incore copy. This routine will internally commit the current |
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h index 175b126d2cab..f316cb85d8e2 100644 --- a/fs/xfs/xfs_utils.h +++ b/fs/xfs/xfs_utils.h | |||
@@ -21,8 +21,6 @@ | |||
21 | #define IRELE(ip) VN_RELE(XFS_ITOV(ip)) | 21 | #define IRELE(ip) VN_RELE(XFS_ITOV(ip)) |
22 | #define IHOLD(ip) VN_HOLD(XFS_ITOV(ip)) | 22 | #define IHOLD(ip) VN_HOLD(XFS_ITOV(ip)) |
23 | 23 | ||
24 | extern int xfs_dir_lookup_int(xfs_inode_t *, uint, struct xfs_name *, | ||
25 | xfs_ino_t *, xfs_inode_t **); | ||
26 | extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *); | 24 | extern int xfs_truncate_file(xfs_mount_t *, xfs_inode_t *); |
27 | extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, | 25 | extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, |
28 | xfs_dev_t, cred_t *, prid_t, int, | 26 | xfs_dev_t, cred_t *, prid_t, int, |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 322ba094dcc8..308dfff76ae2 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -1982,7 +1982,7 @@ again: | |||
1982 | 1982 | ||
1983 | ips[0] = ip; | 1983 | ips[0] = ip; |
1984 | ips[1] = dp; | 1984 | ips[1] = dp; |
1985 | xfs_lock_inodes(ips, 2, 0, XFS_ILOCK_EXCL); | 1985 | xfs_lock_inodes(ips, 2, XFS_ILOCK_EXCL); |
1986 | } | 1986 | } |
1987 | /* else e_inum == dp->i_ino */ | 1987 | /* else e_inum == dp->i_ino */ |
1988 | /* This can happen if we're asked to lock /x/.. | 1988 | /* This can happen if we're asked to lock /x/.. |
@@ -2030,7 +2030,6 @@ void | |||
2030 | xfs_lock_inodes( | 2030 | xfs_lock_inodes( |
2031 | xfs_inode_t **ips, | 2031 | xfs_inode_t **ips, |
2032 | int inodes, | 2032 | int inodes, |
2033 | int first_locked, | ||
2034 | uint lock_mode) | 2033 | uint lock_mode) |
2035 | { | 2034 | { |
2036 | int attempts = 0, i, j, try_lock; | 2035 | int attempts = 0, i, j, try_lock; |
@@ -2038,13 +2037,8 @@ xfs_lock_inodes( | |||
2038 | 2037 | ||
2039 | ASSERT(ips && (inodes >= 2)); /* we need at least two */ | 2038 | ASSERT(ips && (inodes >= 2)); /* we need at least two */ |
2040 | 2039 | ||
2041 | if (first_locked) { | 2040 | try_lock = 0; |
2042 | try_lock = 1; | 2041 | i = 0; |
2043 | i = 1; | ||
2044 | } else { | ||
2045 | try_lock = 0; | ||
2046 | i = 0; | ||
2047 | } | ||
2048 | 2042 | ||
2049 | again: | 2043 | again: |
2050 | for (; i < inodes; i++) { | 2044 | for (; i < inodes; i++) { |
@@ -2406,7 +2400,7 @@ xfs_link( | |||
2406 | ips[1] = sip; | 2400 | ips[1] = sip; |
2407 | } | 2401 | } |
2408 | 2402 | ||
2409 | xfs_lock_inodes(ips, 2, 0, XFS_ILOCK_EXCL); | 2403 | xfs_lock_inodes(ips, 2, XFS_ILOCK_EXCL); |
2410 | 2404 | ||
2411 | /* | 2405 | /* |
2412 | * Increment vnode ref counts since xfs_trans_commit & | 2406 | * Increment vnode ref counts since xfs_trans_commit & |
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h index 6b66904a3837..ba798fccf72b 100644 --- a/fs/xfs/xfs_vnodeops.h +++ b/fs/xfs/xfs_vnodeops.h | |||
@@ -47,7 +47,7 @@ int xfs_change_file_space(struct xfs_inode *ip, int cmd, | |||
47 | struct cred *credp, int attr_flags); | 47 | struct cred *credp, int attr_flags); |
48 | int xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name, | 48 | int xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name, |
49 | struct xfs_inode *src_ip, struct xfs_inode *target_dp, | 49 | struct xfs_inode *src_ip, struct xfs_inode *target_dp, |
50 | struct xfs_name *target_name); | 50 | struct xfs_name *target_name, struct xfs_inode *target_ip); |
51 | int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value, | 51 | int xfs_attr_get(struct xfs_inode *ip, const char *name, char *value, |
52 | int *valuelenp, int flags, cred_t *cred); | 52 | int *valuelenp, int flags, cred_t *cred); |
53 | int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value, | 53 | int xfs_attr_set(struct xfs_inode *dp, const char *name, char *value, |