Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / linux-2.4.24-jbd-handle-EIO.patch
1 diff -X /home/nikita/src/linux-git/linux-2.6.git/Documentation/dontdiff -rupbB linux-2.4.24.orig/fs/jbd/commit.c linux-2.4.24/fs/jbd/commit.c
2 --- linux-2.4.24.orig/fs/jbd/commit.c   2005-06-23 17:39:32.000000000 +0400
3 +++ linux-2.4.24/fs/jbd/commit.c        2005-06-23 15:56:05.000000000 +0400
4 @@ -47,7 +47,7 @@ void journal_commit_transaction(journal_
5         struct buffer_head *wbuf[64];
6         int bufs;
7         int flags;
8 -       int err;
9 +       int err = 0;
10         unsigned long blocknr;
11         char *tagp = NULL;
12         journal_header_t *header;
13 @@ -505,6 +505,9 @@ start_journal_io:
14                         goto wait_for_iobuf;
15                 }
16  
17 +               if (unlikely(!buffer_uptodate(bh)))
18 +                       err = -EIO;
19 +
20                 clear_bit(BH_JWrite, &jh2bh(jh)->b_state);
21  
22                 JBUFFER_TRACE(jh, "ph4: unfile after journal write");
23 @@ -566,6 +569,9 @@ start_journal_io:
24                         goto wait_for_ctlbuf;
25                 }
26  
27 +               if (unlikely(!buffer_uptodate(bh)))
28 +                       err = -EIO;
29 +
30                 BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile");
31                 clear_bit(BH_JWrite, &bh->b_state);
32                 journal_unfile_buffer(jh);
33 @@ -610,6 +616,8 @@ start_journal_io:
34                 bh->b_end_io = journal_end_buffer_io_sync;
35                 submit_bh(WRITE, bh);
36                 wait_on_buffer(bh);
37 +               if (unlikely(!buffer_uptodate(bh)))
38 +                       err = -EIO;
39                 put_bh(bh);             /* One for getblk() */
40                 journal_unlock_journal_head(descriptor);
41         }
42 @@ -621,6 +629,9 @@ start_journal_io:
43  
44  skip_commit: /* The journal should be unlocked by now. */
45  
46 +       if (err)
47 +               __journal_abort_hard(journal);
48 +
49         /* Call any callbacks that had been registered for handles in this
50          * transaction.  It is up to the callback to free any allocated
51          * memory.