Whamcloud - gitweb
LU-13134 llite: fix to free cl_dio_aio properly 03/39103/6
authorWang Shilong <wshilong@ddn.com>
Fri, 19 Jun 2020 13:59:42 +0000 (21:59 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 Jul 2020 03:04:34 +0000 (03:04 +0000)
@cl_dio_aio is allocated by slab, we should use slab
free helper to free its memory.

Fixes: 3db1d ("LU-13134 obdclass: use slab allocation for cl_dio_aio")
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: Ic82f4dec5e9bb6de7a531c224fa23248d4f7d63d
Reviewed-on: https://review.whamcloud.com/39103
Reviewed-by: Patrick Farrell <farr0186@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/include/cl_object.h
lustre/llite/rw26.c
lustre/obdclass/cl_io.c

index b65e140..9a5ec9e 100644 (file)
@@ -2523,6 +2523,7 @@ int  cl_sync_io_wait(const struct lu_env *env, struct cl_sync_io *anchor,
 void cl_sync_io_note(const struct lu_env *env, struct cl_sync_io *anchor,
                     int ioret);
 struct cl_dio_aio *cl_aio_alloc(struct kiocb *iocb);
+void cl_aio_free(struct cl_dio_aio *aio);
 static inline void cl_sync_io_init(struct cl_sync_io *anchor, int nr)
 {
        cl_sync_io_init_notify(anchor, nr, NULL, NULL);
index 28b85c0..d6b6196 100644 (file)
@@ -492,8 +492,7 @@ out:
                        vio->u.write.vui_written += tot_bytes;
                        result = tot_bytes;
                }
-               OBD_FREE_PTR(aio);
-
+               cl_aio_free(aio);
        } else {
                result = -EIOCBQUEUED;
        }
index 76fe87b..4afe3d0 100644 (file)
@@ -1191,6 +1191,13 @@ struct cl_dio_aio *cl_aio_alloc(struct kiocb *iocb)
 }
 EXPORT_SYMBOL(cl_aio_alloc);
 
+void cl_aio_free(struct cl_dio_aio *aio)
+{
+       if (aio)
+               OBD_SLAB_FREE_PTR(aio, cl_dio_aio_kmem);
+}
+EXPORT_SYMBOL(cl_aio_free);
+
 
 /**
  * Indicate that transfer of a single page completed.
@@ -1233,8 +1240,7 @@ void cl_sync_io_note(const struct lu_env *env, struct cl_sync_io *anchor,
                 * If anchor->csi_aio is set, we are responsible for freeing
                 * memory here rather than when cl_sync_io_wait() completes.
                 */
-               if (aio)
-                       OBD_SLAB_FREE_PTR(aio, cl_dio_aio_kmem);
+               cl_aio_free(aio);
        }
        EXIT;
 }