diff -urN linux-2.4.3-XFS.orig/fs/pagebuf/page_buf_locking.c linux-2.4.3-XFS/fs/pagebuf/page_buf_locking.c --- linux-2.4.3-XFS.orig/fs/pagebuf/page_buf_locking.c Sat Apr 7 10:13:20 2001 +++ linux-2.4.3-XFS/fs/pagebuf/page_buf_locking.c Sun Apr 8 08:41:01 2001 @@ -442,49 +442,50 @@ int status; page_buf_t *pb; -retry_scan: - status = _pagebuf_find_lockable_buffer(ip, reg, range_base, - range_length, flags, pb_p); + for (;;) { + status = _pagebuf_find_lockable_buffer(ip, reg, range_base, + range_length, flags, pb_p); - if (status) - return status; + if (status) + return status; - if (*pb_p) - return 0; + if (*pb_p) + return 0; - status = _pagebuf_get_object(ip, range_base, range_length, - flags | _PBF_LOCKABLE, &pb); - if (status != 0) { - return(status); - } + status = _pagebuf_get_object(ip, range_base, range_length, + flags | _PBF_LOCKABLE, &pb); + if (status != 0) { + return(status); + } - /* Tree manipulation requires the registration spinlock */ - spin_lock_irq(®->pbr_lock); - status = avl_insert(reg->pbr_buffers, - (avl_key_t) pb, - (avl_value_t) pb); - spin_unlock_irq(®->pbr_lock); - PB_TRACE(pb, PB_TRACE_REC(avl_ins), status); - if (status != 0) { - unsigned long flags; - - spin_lock_irqsave(&PBP(pb)->pb_lock, flags); - pb->pb_flags &= ~_PBF_LOCKABLE; /* we are not in the avl */ - _pagebuf_free_object(pb, flags); - if (status == -EEXIST) { - /* Race condition with another thread - try again, - * set up locking state first. - */ - spin_lock_irq(®->pbr_lock); - goto retry_scan; + /* Tree manipulation requires the registration spinlock */ + spin_lock_irq(®->pbr_lock); + status = avl_insert(reg->pbr_buffers, + (avl_key_t) pb, + (avl_value_t) pb); + spin_unlock_irq(®->pbr_lock); + PB_TRACE(pb, PB_TRACE_REC(avl_ins), status); + if (status != 0) { + unsigned long flags; + + spin_lock_irqsave(&PBP(pb)->pb_lock, flags); + pb->pb_flags &= ~_PBF_LOCKABLE; /* we are not in the avl */ + _pagebuf_free_object(pb, flags); + if (status == -EEXIST) { + /* Race condition with another thread - try again, + * set up locking state first. + */ + spin_lock_irq(®->pbr_lock); + continue; + } + return(status); } - return(status); - } - *pb_p = pb; - return(0); + *pb_p = pb; + return(0); + } } /*