fix
authorMiklos Szeredi <miklos@szeredi.hu>
Fri, 2 Jul 2004 21:22:37 +0000 (21:22 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Fri, 2 Jul 2004 21:22:37 +0000 (21:22 +0000)
ChangeLog
kernel/file.c

index fe3bfdbc560080f1bc60609b2e98a8f2e04ac843..ed6a9995a66bfa7f5a227a728af61d4374e71f88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,9 @@
        will allow non root user to specify the 'allow_other' mount option
        ('-x' option of fusermount)
 
+       * Fix deadlock between page writeback completion and truncate
+       (bug found by Valient Gough with the fsx-linux utility)
+
 2004-07-01  Miklos Szeredi <mszeredi@inf.bme.hu>
 
        * Change passing fuse include dir to 2.6 kernel make system more
index d7b61ea68f575360042a4f5e52bbd5b337afcbf8..0b756374ddbb5b2f97ffe2cc344805cbbe8d87c0 100644 (file)
@@ -480,7 +480,6 @@ static void write_buffer_end(struct fuse_conn *fc, struct fuse_req *req)
                req->out.h.error = -EPROTO;
        }
 
-       lock_page(page);
        if (req->out.h.error) {
                SetPageError(page);
                if (req->out.h.error == -ENOSPC)
@@ -490,7 +489,6 @@ static void write_buffer_end(struct fuse_conn *fc, struct fuse_req *req)
        }
        end_page_writeback(page);
        kunmap(page);
-       unlock_page(page);
        fuse_put_request(fc, req);
 }
 
@@ -535,10 +533,11 @@ static int fuse_writepage(struct page *page, struct writeback_control *wbc)
                /* FIXME: check sync_mode, and wait for previous writes (or
                   signal userspace to do this) */
                if (wbc->nonblocking) {
+                       SetPageWriteback(page);
                        err = write_buffer_nonblock(inode, page, 0, count);
-                       if (!err)
-                               SetPageWriteback(page);
-                       else if (err == -EWOULDBLOCK) {
+                       if (err)
+                               ClearPageWriteback(page);
+                       if (err == -EWOULDBLOCK) {
                                __set_page_dirty_nobuffers(page);
                                err = 0;
                        }