diff mbox series

[v1] xfs: return err code if xfs_buf_associate_memory fail

Message ID 20210323062456.67938-1-zp_8483@163.com (mailing list archive)
State New
Headers show
Series [v1] xfs: return err code if xfs_buf_associate_memory fail | expand

Commit Message

Zhen Zhao March 23, 2021, 6:24 a.m. UTC
In kernel 3.10, when there is no memory left in the
system, fs_buf_associate_memory can fail, catch the
error and return.

Signed-off-by: Zhen Zhao <zp_8483@163.com>
---
 fs/xfs/xfs_log.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Darrick J. Wong March 23, 2021, 4:13 p.m. UTC | #1
On Tue, Mar 23, 2021 at 02:24:56AM -0400, Zhen Zhao wrote:
> In kernel 3.10, when there is no memory left in the
> system, fs_buf_associate_memory can fail, catch the
> error and return.

You're probably going to need to take this up with your kernel
distributor or the linux stable fixes list, since (AFAICT) none of this
exists in the upstream kernel.

--D

> Signed-off-by: Zhen Zhao <zp_8483@163.com>
> ---
>  fs/xfs/xfs_log.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 2e5581bc..32a41bf5 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1916,8 +1916,11 @@ xlog_sync(
>  	if (split) {
>  		bp = iclog->ic_log->l_xbuf;
>  		XFS_BUF_SET_ADDR(bp, 0);	     /* logical 0 */
> -		xfs_buf_associate_memory(bp,
> +		error = xfs_buf_associate_memory(bp,
>  				(char *)&iclog->ic_header + count, split);
> +		if (error)
> +			return error;
> +
>  		bp->b_fspriv = iclog;
>  		bp->b_flags &= ~XBF_FLUSH;
>  		bp->b_flags |= (XBF_ASYNC | XBF_SYNCIO | XBF_WRITE | XBF_FUA);
> -- 
> 2.27.0
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 2e5581bc..32a41bf5 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1916,8 +1916,11 @@  xlog_sync(
 	if (split) {
 		bp = iclog->ic_log->l_xbuf;
 		XFS_BUF_SET_ADDR(bp, 0);	     /* logical 0 */
-		xfs_buf_associate_memory(bp,
+		error = xfs_buf_associate_memory(bp,
 				(char *)&iclog->ic_header + count, split);
+		if (error)
+			return error;
+
 		bp->b_fspriv = iclog;
 		bp->b_flags &= ~XBF_FLUSH;
 		bp->b_flags |= (XBF_ASYNC | XBF_SYNCIO | XBF_WRITE | XBF_FUA);