]> err.no Git - linux-2.6/blobdiff - fs/gfs2/glock.c
bio: fix __bio_copy_iov() handling of bio->bv_len
[linux-2.6] / fs / gfs2 / glock.c
index cd0aa213fb2f56e29037f9f152637ddde1bcee2a..13391e546616ce47a9b413dde1ac73ad396d808d 100644 (file)
@@ -267,8 +267,12 @@ static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holde
                return 1;
        if (gh->gh_flags & GL_EXACT)
                return 0;
-       if (gh->gh_state == LM_ST_SHARED && gl->gl_state == LM_ST_EXCLUSIVE)
-               return 1;
+       if (gl->gl_state == LM_ST_EXCLUSIVE) {
+               if (gh->gh_state == LM_ST_SHARED && gh_head->gh_state == LM_ST_SHARED)
+                       return 1;
+               if (gh->gh_state == LM_ST_DEFERRED && gh_head->gh_state == LM_ST_DEFERRED)
+                       return 1;
+       }
        if (gl->gl_state != LM_ST_UNLOCKED && (gh->gh_flags & LM_FLAG_ANY))
                return 1;
        return 0;