diff for duplicates of <20190209090254.GC4865@kadam> diff --git a/a/1.txt b/N1/1.txt index 86efbe7..463c800 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -4,8 +4,8 @@ different locks. But now it's just one lock and the static checkers think we can call down_read(&fs_info->subvol_sem); twice in a row which would lead to a deadlock. -That code is several years old now so presumably both (old_ino = -BTRFS_FIRST_FREE_OBJECTID) and (new_ino = BTRFS_FIRST_FREE_OBJECTID) +That code is several years old now so presumably both (old_ino == +BTRFS_FIRST_FREE_OBJECTID) and (new_ino == BTRFS_FIRST_FREE_OBJECTID) conditions can't be true at the same time or the bug would have showed up in testing. I have re-written the code though to make it cleaner and to silence the static checkers. @@ -23,11 +23,11 @@ index 9b0e3e2d589c..039a12f51cd7 100644 btrfs_init_log_ctx(&ctx_dest, new_inode); /* close the race window with snapshot create/destroy ioctl */ -- if (old_ino = BTRFS_FIRST_FREE_OBJECTID) +- if (old_ino == BTRFS_FIRST_FREE_OBJECTID) - down_read(&fs_info->subvol_sem); -- if (new_ino = BTRFS_FIRST_FREE_OBJECTID) -+ if (old_ino = BTRFS_FIRST_FREE_OBJECTID || -+ new_ino = BTRFS_FIRST_FREE_OBJECTID) +- if (new_ino == BTRFS_FIRST_FREE_OBJECTID) ++ if (old_ino == BTRFS_FIRST_FREE_OBJECTID || ++ new_ino == BTRFS_FIRST_FREE_OBJECTID) down_read(&fs_info->subvol_sem); /* @@ -35,11 +35,11 @@ index 9b0e3e2d589c..039a12f51cd7 100644 ret = ret ? ret : ret2; } out_notrans: -- if (new_ino = BTRFS_FIRST_FREE_OBJECTID) +- if (new_ino == BTRFS_FIRST_FREE_OBJECTID) - up_read(&fs_info->subvol_sem); -- if (old_ino = BTRFS_FIRST_FREE_OBJECTID) -+ if (new_ino = BTRFS_FIRST_FREE_OBJECTID || -+ old_ino = BTRFS_FIRST_FREE_OBJECTID) +- if (old_ino == BTRFS_FIRST_FREE_OBJECTID) ++ if (new_ino == BTRFS_FIRST_FREE_OBJECTID || ++ old_ino == BTRFS_FIRST_FREE_OBJECTID) up_read(&fs_info->subvol_sem); return ret; diff --git a/a/content_digest b/N1/content_digest index f7e1160..ba4bcaf 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,6 +1,6 @@ "From\0Dan Carpenter <dan.carpenter@oracle.com>\0" "Subject\0[PATCH] btrfs: Silence a static checker locking warning\0" - "Date\0Sat, 09 Feb 2019 09:02:55 +0000\0" + "Date\0Sat, 9 Feb 2019 12:02:55 +0300\0" "To\0Chris Mason <clm@fb.com>" " Jeff Mahoney <jeffm@suse.com>\0" "Cc\0Josef Bacik <josef@toxicpanda.com>" @@ -15,8 +15,8 @@ "think we can call down_read(&fs_info->subvol_sem); twice in a row which\n" "would lead to a deadlock.\n" "\n" - "That code is several years old now so presumably both (old_ino =\n" - "BTRFS_FIRST_FREE_OBJECTID) and (new_ino = BTRFS_FIRST_FREE_OBJECTID)\n" + "That code is several years old now so presumably both (old_ino ==\n" + "BTRFS_FIRST_FREE_OBJECTID) and (new_ino == BTRFS_FIRST_FREE_OBJECTID)\n" "conditions can't be true at the same time or the bug would have showed\n" "up in testing. I have re-written the code though to make it cleaner and\n" "to silence the static checkers.\n" @@ -34,11 +34,11 @@ " \tbtrfs_init_log_ctx(&ctx_dest, new_inode);\n" " \n" " \t/* close the race window with snapshot create/destroy ioctl */\n" - "-\tif (old_ino = BTRFS_FIRST_FREE_OBJECTID)\n" + "-\tif (old_ino == BTRFS_FIRST_FREE_OBJECTID)\n" "-\t\tdown_read(&fs_info->subvol_sem);\n" - "-\tif (new_ino = BTRFS_FIRST_FREE_OBJECTID)\n" - "+\tif (old_ino = BTRFS_FIRST_FREE_OBJECTID ||\n" - "+\t new_ino = BTRFS_FIRST_FREE_OBJECTID)\n" + "-\tif (new_ino == BTRFS_FIRST_FREE_OBJECTID)\n" + "+\tif (old_ino == BTRFS_FIRST_FREE_OBJECTID ||\n" + "+\t new_ino == BTRFS_FIRST_FREE_OBJECTID)\n" " \t\tdown_read(&fs_info->subvol_sem);\n" " \n" " \t/*\n" @@ -46,15 +46,15 @@ " \t\tret = ret ? ret : ret2;\n" " \t}\n" " out_notrans:\n" - "-\tif (new_ino = BTRFS_FIRST_FREE_OBJECTID)\n" + "-\tif (new_ino == BTRFS_FIRST_FREE_OBJECTID)\n" "-\t\tup_read(&fs_info->subvol_sem);\n" - "-\tif (old_ino = BTRFS_FIRST_FREE_OBJECTID)\n" - "+\tif (new_ino = BTRFS_FIRST_FREE_OBJECTID ||\n" - "+\t old_ino = BTRFS_FIRST_FREE_OBJECTID)\n" + "-\tif (old_ino == BTRFS_FIRST_FREE_OBJECTID)\n" + "+\tif (new_ino == BTRFS_FIRST_FREE_OBJECTID ||\n" + "+\t old_ino == BTRFS_FIRST_FREE_OBJECTID)\n" " \t\tup_read(&fs_info->subvol_sem);\n" " \n" " \treturn ret;\n" "-- \n" 2.17.1 -a5bc1d06570efb210675bdb9f5fad08c6c2460264c2e41e04513b3a348f9bd66 +ddfa79ceb654ea20ee42b9a86f044e48fe5f0401f93c4cda1280568170662766
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.