Commit 8832fc1
committed
udf: Fix lock ordering in udf_evict_inode()
udf_evict_inode() calls udf_setsize() to truncate deleted inode.
However inode deletion through udf_evict_inode() can happen from inode
reclaim context and udf_setsize() grabs mapping->invalidate_lock which
isn't generally safe to acquire from fs reclaim context since we
allocate pages under mapping->invalidate_lock for example in a page
fault path. This is however not a real deadlock possibility as by the
time udf_evict_inode() is called, nobody can be accessing the inode,
even less work with its page cache. So this is just a lockdep triggering
false positive. Fix the problem by moving mapping->invalidate_lock
locking outsize of udf_setsize() into udf_setattr() as grabbing
mapping->invalidate_lock from udf_evict_inode() is pointless.
Reported-by: syzbot+0333a6f4b88bcd68a62f@syzkaller.appspotmail.com
Fixes: b9a861f ("udf: Protect truncate and file type conversion with invalidate_lock")
Signed-off-by: Jan Kara <jack@suse.cz>1 parent c1f1b25 commit 8832fc1
2 files changed
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
235 | 236 | | |
| 237 | + | |
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1248 | 1248 | | |
1249 | 1249 | | |
1250 | 1250 | | |
1251 | | - | |
1252 | 1251 | | |
1253 | 1252 | | |
1254 | 1253 | | |
| |||
1261 | 1260 | | |
1262 | 1261 | | |
1263 | 1262 | | |
1264 | | - | |
| 1263 | + | |
1265 | 1264 | | |
1266 | 1265 | | |
1267 | 1266 | | |
1268 | | - | |
| 1267 | + | |
1269 | 1268 | | |
1270 | 1269 | | |
1271 | 1270 | | |
| |||
1283 | 1282 | | |
1284 | 1283 | | |
1285 | 1284 | | |
1286 | | - | |
| 1285 | + | |
1287 | 1286 | | |
1288 | 1287 | | |
1289 | 1288 | | |
1290 | 1289 | | |
1291 | 1290 | | |
1292 | 1291 | | |
1293 | | - | |
| 1292 | + | |
1294 | 1293 | | |
1295 | 1294 | | |
1296 | 1295 | | |
1297 | 1296 | | |
1298 | 1297 | | |
1299 | 1298 | | |
1300 | 1299 | | |
1301 | | - | |
1302 | | - | |
1303 | 1300 | | |
1304 | 1301 | | |
1305 | 1302 | | |
| |||
0 commit comments