Whamcloud - gitweb
9fa919498462a28d0e29e5be6f32779d35516625
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7.2 / ext4-dont-check-in-ro.patch
1 --- linux-stage/fs/ext4/mballoc.c       2016-11-25 04:15:25.824396109 +0530
2 +++ linux-stage.orig/fs/ext4/mballoc.c  2016-11-25 02:59:13.505151246 +0530
3 @@ -3594,6 +3594,11 @@
4         unsigned short max = EXT4_CLUSTERS_PER_GROUP(sb);
5         unsigned short i, first, free = 0;
6  
7 +#ifdef HAVE_CLEAR_RDONLY_ON_PUT
8 +       /* be quiet if readonly device */
9 +       if (dev_check_rdonly(sb->s_bdev))
10 +               return 0;
11 +#endif
12         i = mb_find_next_zero_bit(bitmap, max, 0);
13  
14         while (i < max) {
15 @@ -3969,6 +3974,14 @@
16                 bit = next + 1;
17         }
18  
19 +
20 +#ifdef HAVE_CLEAR_RDONLY_ON_PUT
21 +       /* be quiet if readonly device */
22 +       if (dev_check_rdonly(sb->s_bdev)) {
23 +               atomic_add(free, &sbi->s_mb_discarded);
24 +               return err;
25 +       }
26 +#endif
27         /* "free < pa->pa_free" means we maybe double alloc the same blocks,
28          * otherwise maybe leave some free blocks unavailable, no need to BUG.*/
29         if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) {