[Linux-cachefs] [PATCH] cachefiles deadlock with 3.10 + fscache-20130702

Shantanu Goel sgoel01 at yahoo.com
Wed Aug 6 11:29:01 UTC 2014


Hi David,

Thanks for cleaning up the patch but tt seems this patch may no longer be needed with the timed wait_on_page patch that Milosz posted.  We have been running with Milosz's timeout patch for a few weeks now and have not encountered this deadlock.

Thanks,
Shantanu



On Wednesday, August 6, 2014 7:21 AM, David Howells <dhowells at redhat.com> wrote:
 

>
>
>David Howells <dhowells at redhat.com> wrote:
>
>> It seems that your mail client replaced all the tabs in the patch with
>> multiple 0xA0 characters plus a space.
>
>Here's a cleaned up patch that applies.
>
>
>David
>---
>diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
>index 25e745b8eb1b..ebeaaf7ac6f0 100644
>--- a/fs/cachefiles/rdwr.c
>+++ b/fs/cachefiles/rdwr.c
>@@ -916,6 +916,19 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
>    } else {
>        ret = -EIO;
>        if (file->f_op->write) {
>+            struct address_space *mapping = file->f_mapping;
>+            gfp_t gfp_mask = mapping_gfp_mask(mapping);
>+            gfp_t gfp_mask_orig = gfp_mask;
>+
>+            /*
>+             * Clear __GFP_FS to avoid potential deadlock
>+             * during memory reclaim.
>+             */
>+            if (gfp_mask & __GFP_FS) {
>+                gfp_mask &= ~__GFP_FS;
>+                mapping_set_gfp_mask(mapping, gfp_mask);
>+            }
>+
>            pos = (loff_t) page->index << PAGE_SHIFT;
>
>            /* we mustn't write more data than we have, so we have
>@@ -943,6 +956,9 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
>            file_end_write(file);
>            if (ret != len)
>                ret = -EIO;
>+
>+            if (gfp_mask != gfp_mask_orig)
>+                mapping_set_gfp_mask(gfp_mask_orig);
>        }
>        fput(file);
>
>    }
>
>


More information about the Linux-cachefs mailing list