--- 2.4.4-pre3/mm/shmem.c Sat Apr 14 11:12:54 2001 +++ u2.4.3/mm/shmem.c Sun Apr 15 13:45:58 2001 @@ -123,10 +123,19 @@ entry = *ptr; *ptr = (swp_entry_t){0}; freed++; +#if 0 + /* + * This does not work since it may sleep while holding + * a spinlock + * + * We rely on the page stealer to free up the + * allocated swap space later + */ if ((page = lookup_swap_cache(entry)) != NULL) { delete_from_swap_cache(page); page_cache_release(page); } +#endif swap_free (entry); } return freed; @@ -236,8 +245,10 @@ /* Only move to the swap cache if there are no other users of * the page. */ - if (atomic_read(&page->count) > 2) - goto out; + if (atomic_read(&page->count) > 2){ + set_page_dirty(page); + goto out; + } inode = page->mapping->host; info = &inode->u.shmem_i; @@ -348,9 +359,6 @@ if (TryLockPage(page)) goto wait_retry; - if (swap_count(page) > 2) - BUG(); - swap_free(*entry); *entry = (swp_entry_t) {0}; delete_from_swap_cache_nolock(page); @@ -432,6 +440,7 @@ *ptr = NOPAGE_SIGBUS; return error; sigbus: + up (&inode->i_sem); *ptr = NOPAGE_SIGBUS; return -EFAULT; }