Whamcloud - gitweb
LU-8411 ofd: handle last_rcvd file can't update properly
[fs/lustre-release.git] / lustre / ofd / ofd_objects.c
index 07f7dc8..fd0e74a 100644 (file)
@@ -212,11 +212,12 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
        struct thandle          *th;
        struct ofd_object       **batch;
        struct lu_fid           *fid = &info->fti_fid;
-       u64                      tmp;
-       int                      rc;
-       int                      i;
-       int                      objects = 0;
-       int                      nr_saved = nr;
+       u64                     tmp;
+       int                     rc;
+       int                     rc2;
+       int                     i;
+       int                     objects = 0;
+       int                     nr_saved = nr;
 
        ENTRY;
 
@@ -396,7 +397,12 @@ int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
        }
 
 trans_stop:
-       ofd_trans_stop(env, ofd, th, rc);
+       rc2 = ofd_trans_stop(env, ofd, th, rc);
+       if (rc2)
+               CERROR("%s: failed to stop transaction: rc = %d\n",
+                      ofd_name(ofd), rc2);
+       if (!rc)
+               rc = rc2;
 out:
        for (i = 0; i < nr_saved; i++) {
                fo = batch[i];
@@ -495,8 +501,9 @@ int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo,
        struct ofd_device       *ofd = ofd_obj2dev(fo);
        struct thandle          *th;
        struct ofd_mod_data     *fmd;
-       int                      ff_needed = 0;
-       int                      rc;
+       int                     ff_needed = 0;
+       int                     rc;
+       int                     rc2;
        ENTRY;
 
        ofd_write_lock(env, fo);
@@ -571,7 +578,13 @@ int ofd_attr_set(const struct lu_env *env, struct ofd_object *fo,
        GOTO(stop, rc);
 
 stop:
-       ofd_trans_stop(env, ofd, th, rc);
+       rc2 = ofd_trans_stop(env, ofd, th, rc);
+       if (rc2)
+               CERROR("%s: failed to stop transaction: rc = %d\n",
+                      ofd_name(ofd), rc2);
+       if (!rc)
+               rc = rc2;
+
 unlock:
        ofd_write_unlock(env, fo);
 
@@ -606,8 +619,9 @@ int ofd_object_punch(const struct lu_env *env, struct ofd_object *fo,
        struct ofd_mod_data     *fmd;
        struct dt_object        *dob = ofd_object_child(fo);
        struct thandle          *th;
-       int                      ff_needed = 0;
-       int                      rc;
+       int                     ff_needed = 0;
+       int                     rc;
+       int                     rc2;
 
        ENTRY;
 
@@ -698,7 +712,12 @@ int ofd_object_punch(const struct lu_env *env, struct ofd_object *fo,
        GOTO(stop, rc);
 
 stop:
-       ofd_trans_stop(env, ofd, th, rc);
+       rc2 = ofd_trans_stop(env, ofd, th, rc);
+       if (rc2 != 0)
+               CERROR("%s: failed to stop transaction: rc = %d\n",
+                      ofd_name(ofd), rc2);
+       if (!rc)
+               rc = rc2;
 unlock:
        ofd_write_unlock(env, fo);
 
@@ -724,7 +743,8 @@ int ofd_object_destroy(const struct lu_env *env, struct ofd_object *fo,
 {
        struct ofd_device       *ofd = ofd_obj2dev(fo);
        struct thandle          *th;
-       int                      rc = 0;
+       int                     rc = 0;
+       int                     rc2;
 
        ENTRY;
 
@@ -756,7 +776,12 @@ int ofd_object_destroy(const struct lu_env *env, struct ofd_object *fo,
        dt_ref_del(env, ofd_object_child(fo), th);
        dt_destroy(env, ofd_object_child(fo), th);
 stop:
-       ofd_trans_stop(env, ofd, th, rc);
+       rc2 = ofd_trans_stop(env, ofd, th, rc);
+       if (rc2)
+               CERROR("%s failed to stop transaction: %d\n",
+                      ofd_name(ofd), rc2);
+       if (!rc)
+               rc = rc2;
 unlock:
        ofd_write_unlock(env, fo);
        RETURN(rc);