TO: Dave Chinner <da...@fromorbit.com> tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: b0a12fb5bc87820b12df22c64dd680a96443de00 commit: 95afcf5c7bca93fb84d260f70c304f35ef4c3114 [6249/8741] xfs: clean up inode locking for RENAME_WHITEOUT :::::: branch date: 3 days ago :::::: commit date: 12 days ago
New smatch warnings: fs/xfs/xfs_inode.c:357 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4 fs/xfs/xfs_inode.c:359 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4 fs/xfs/xfs_inode.c:381 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4 fs/xfs/xfs_inode.c:387 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4 fs/xfs/xfs_inode.c:401 xfs_lock_inodes() error: buffer overflow 'ips' 4 <= 4 Old smatch warnings: fs/xfs/xfs_inode.c:2863 xfs_rename() error: we previously assumed 'target_ip' could be null (see line 2845) git remote add next git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git remote update next git checkout 95afcf5c7bca93fb84d260f70c304f35ef4c3114 vim +/ips +357 fs/xfs/xfs_inode.c 95afcf5c Dave Chinner 2015-03-25 351 ASSERT(ips && inodes >= 2 && inodes <= 5); c24b5dfa Dave Chinner 2013-08-12 352 c24b5dfa Dave Chinner 2013-08-12 353 try_lock = 0; c24b5dfa Dave Chinner 2013-08-12 354 i = 0; c24b5dfa Dave Chinner 2013-08-12 355 again: c24b5dfa Dave Chinner 2013-08-12 356 for (; i < inodes; i++) { c24b5dfa Dave Chinner 2013-08-12 @357 ASSERT(ips[i]); c24b5dfa Dave Chinner 2013-08-12 358 c24b5dfa Dave Chinner 2013-08-12 @359 if (i && (ips[i] == ips[i - 1])) /* Already locked */ c24b5dfa Dave Chinner 2013-08-12 360 continue; c24b5dfa Dave Chinner 2013-08-12 361 c24b5dfa Dave Chinner 2013-08-12 362 /* 95afcf5c Dave Chinner 2015-03-25 363 * If try_lock is not set yet, make sure all locked inodes are 95afcf5c Dave Chinner 2015-03-25 364 * not in the AIL. If any are, set try_lock to be used later. c24b5dfa Dave Chinner 2013-08-12 365 */ c24b5dfa Dave Chinner 2013-08-12 366 if (!try_lock) { c24b5dfa Dave Chinner 2013-08-12 367 for (j = (i - 1); j >= 0 && !try_lock; j--) { c24b5dfa Dave Chinner 2013-08-12 368 lp = (xfs_log_item_t *)ips[j]->i_itemp; 95afcf5c Dave Chinner 2015-03-25 369 if (lp && (lp->li_flags & XFS_LI_IN_AIL)) c24b5dfa Dave Chinner 2013-08-12 370 try_lock++; c24b5dfa Dave Chinner 2013-08-12 371 } c24b5dfa Dave Chinner 2013-08-12 372 } c24b5dfa Dave Chinner 2013-08-12 373 c24b5dfa Dave Chinner 2013-08-12 374 /* c24b5dfa Dave Chinner 2013-08-12 375 * If any of the previous locks we have locked is in the AIL, c24b5dfa Dave Chinner 2013-08-12 376 * we must TRY to get the second and subsequent locks. If c24b5dfa Dave Chinner 2013-08-12 377 * we can't get any, we must release all we have c24b5dfa Dave Chinner 2013-08-12 378 * and try again. c24b5dfa Dave Chinner 2013-08-12 379 */ 95afcf5c Dave Chinner 2015-03-25 380 if (!try_lock) { 95afcf5c Dave Chinner 2015-03-25 @381 xfs_ilock(ips[i], xfs_lock_inumorder(lock_mode, i)); 95afcf5c Dave Chinner 2015-03-25 382 continue; 95afcf5c Dave Chinner 2015-03-25 383 } c24b5dfa Dave Chinner 2013-08-12 384 95afcf5c Dave Chinner 2015-03-25 385 /* try_lock means we have an inode locked that is in the AIL. */ c24b5dfa Dave Chinner 2013-08-12 386 ASSERT(i != 0); 95afcf5c Dave Chinner 2015-03-25 @387 if (xfs_ilock_nowait(ips[i], xfs_lock_inumorder(lock_mode, i))) 95afcf5c Dave Chinner 2015-03-25 388 continue; c24b5dfa Dave Chinner 2013-08-12 389 c24b5dfa Dave Chinner 2013-08-12 390 /* 95afcf5c Dave Chinner 2015-03-25 391 * Unlock all previous guys and try again. xfs_iunlock will try 95afcf5c Dave Chinner 2015-03-25 392 * to push the tail if the inode is in the AIL. c24b5dfa Dave Chinner 2013-08-12 393 */ 95afcf5c Dave Chinner 2015-03-25 394 attempts++; c24b5dfa Dave Chinner 2013-08-12 395 for (j = i - 1; j >= 0; j--) { c24b5dfa Dave Chinner 2013-08-12 396 /* 95afcf5c Dave Chinner 2015-03-25 397 * Check to see if we've already unlocked this one. Not 95afcf5c Dave Chinner 2015-03-25 398 * the first one going back, and the inode ptr is the 95afcf5c Dave Chinner 2015-03-25 399 * same. c24b5dfa Dave Chinner 2013-08-12 400 */ 95afcf5c Dave Chinner 2015-03-25 @401 if (j != (i - 1) && ips[j] == ips[j + 1]) c24b5dfa Dave Chinner 2013-08-12 402 continue; c24b5dfa Dave Chinner 2013-08-12 403 c24b5dfa Dave Chinner 2013-08-12 404 xfs_iunlock(ips[j], lock_mode); :::::: The code at line 357 was first introduced by commit :::::: c24b5dfadc4a4f7a13af373067871479c74455e6 xfs: kill xfs_vnodeops.[ch] :::::: TO: Dave Chinner <dchin...@redhat.com> :::::: CC: Ben Myers <b...@sgi.com> --- 0-DAY kernel test infrastructure Open Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation _______________________________________________ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild