Signed-off-by: Matheus Tavares <matheus.bernard...@usp.br>
---

This is just a small fixup to be squashed into patch 6: with multiple
locks, the locking order must be consistent across all critical sections
to avoid dead-lock. Since grep_attr_lock() is called before
obj_read_lock() in grep_source_load_driver(), it must also be called
first here.


 grep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grep.c b/grep.c
index 0ca400f7b6..85ee89b5d6 100644
--- a/grep.c
+++ b/grep.c
@@ -1813,11 +1813,11 @@ static int grep_source_1(struct grep_opt *opt, struct 
grep_source *gs, int colle
                 * currenty thread-safe and might be racy with object reading,
                 * obj_read_lock() must be called.
                 */
-               obj_read_lock();
                grep_attr_lock();
+               obj_read_lock();
                textconv = userdiff_get_textconv(opt->repo, gs->driver);
-               grep_attr_unlock();
                obj_read_unlock();
+               grep_attr_unlock();
        }
 
        /*
-- 
2.23.0

Reply via email to