Whamcloud - gitweb
LU-4825 ofd: fix OBD_FAIL_OST_ENOINO/ENOSPC behaviour 63/20163/5
authorAndreas Dilger <andreas.dilger@intel.com>
Sat, 21 Nov 2015 05:51:15 +0000 (22:51 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Mar 2017 02:58:02 +0000 (02:58 +0000)
Fix the OBD_FAIL_OST_ENOINO and OBD_FAIL_OST_ENOSPC behaviour so that
they also reduce the total number of inodes or blocks when setting the
number of free inodes/blocks to zero.  This allows "lfs df [-i]" to
still report the correct number of blocks and inodes used on the OST.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Ia746273e19aed22a0926708899de009b8d5cab07
Reviewed-on: https://review.whamcloud.com/20163
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ofd/ofd_obd.c

index 2c492f2..9092ca8 100644 (file)
@@ -856,8 +856,11 @@ int ofd_statfs(const struct lu_env *env,  struct obd_export *exp,
               osfs->os_files, osfs->os_ffree, osfs->os_state);
 
        if (OBD_FAIL_CHECK_VALUE(OBD_FAIL_OST_ENOINO,
-                                ofd->ofd_lut.lut_lsd.lsd_osd_index))
-               osfs->os_ffree = 0;
+                                ofd->ofd_lut.lut_lsd.lsd_osd_index)) {
+               /* Reduce free inode count to zero, but keep "used" intact */
+               osfs->os_files -= osfs->os_ffree;
+               osfs->os_ffree -= osfs->os_ffree;
+       }
 
        /* OS_STATE_READONLY can be set by OSD already */
        if (ofd->ofd_raid_degraded)
@@ -877,8 +880,12 @@ int ofd_statfs(const struct lu_env *env,  struct obd_export *exp,
        }
 
        if (OBD_FAIL_CHECK_VALUE(OBD_FAIL_OST_ENOSPC,
-                                ofd->ofd_lut.lut_lsd.lsd_osd_index))
-               osfs->os_bfree = osfs->os_bavail = 2;
+                                ofd->ofd_lut.lut_lsd.lsd_osd_index)) {
+               /* Reduce free blocks count near zero, but keep "used" intact */
+               osfs->os_bavail -= osfs->os_bavail - 2;
+               osfs->os_blocks -= osfs->os_bfree - 2;
+               osfs->os_bfree -= osfs->os_bfree - 2;
+       }
 
        EXIT;
 out: