From: Wang Shilong Date: Fri, 19 Jun 2020 13:59:42 +0000 (+0800) Subject: LU-13134 llite: fix to free cl_dio_aio properly X-Git-Tag: 2.13.55~53 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f71a539c3e41bae750bcb54b0f9159670148176b LU-13134 llite: fix to free cl_dio_aio properly @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 Change-Id: Ic82f4dec5e9bb6de7a531c224fa23248d4f7d63d Reviewed-on: https://review.whamcloud.com/39103 Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index b65e140..9a5ec9e 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -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); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 28b85c0..d6b6196 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -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; } diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 76fe87b..4afe3d0 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -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; }