public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] fs/dax: create a common implementation to break DAX layouts
@ 2025-01-10  7:03 Dan Carpenter
  2025-01-10 16:57 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-01-10  7:03 UTC (permalink / raw)
  To: Alistair Popple; +Cc: linux-xfs

Hello Alistair Popple,

Commit 738ec092051b ("fs/dax: create a common implementation to break
DAX layouts") from Jan 7, 2025 (linux-next), leads to the following
Smatch static checker warning:

	fs/xfs/xfs_inode.c:3034 xfs_break_layouts()
	error: uninitialized symbol 'error'.

fs/xfs/xfs_inode.c
    3009 int
    3010 xfs_break_layouts(
    3011         struct inode                *inode,
    3012         uint                        *iolock,
    3013         enum layout_break_reason reason)
    3014 {
    3015         bool                        retry;
    3016         int                        error;
    3017 
    3018         xfs_assert_ilocked(XFS_I(inode), XFS_IOLOCK_SHARED | XFS_IOLOCK_EXCL);
    3019 
    3020         do {
    3021                 retry = false;
    3022                 switch (reason) {
    3023                 case BREAK_UNMAP:
    3024                         if (xfs_break_dax_layouts(inode))
    3025                                 break;

What about if we hit this break on the first iteration?

    3026                         fallthrough;
    3027                 case BREAK_WRITE:
    3028                         error = xfs_break_leased_layouts(inode, iolock, &retry);
    3029                         break;
    3030                 default:
    3031                         WARN_ON_ONCE(1);
    3032                         error = -EINVAL;
    3033                 }
--> 3034         } while (error == 0 && retry);
    3035 
    3036         return error;
    3037 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] fs/dax: create a common implementation to break DAX layouts
  2025-01-10  7:03 [bug report] fs/dax: create a common implementation to break DAX layouts Dan Carpenter
@ 2025-01-10 16:57 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2025-01-10 16:57 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Alistair Popple, linux-xfs

On Fri, Jan 10, 2025 at 10:03:18AM +0300, Dan Carpenter wrote:
> Hello Alistair Popple,
> 
> Commit 738ec092051b ("fs/dax: create a common implementation to break
> DAX layouts") from Jan 7, 2025 (linux-next), leads to the following
> Smatch static checker warning:
> 
> 	fs/xfs/xfs_inode.c:3034 xfs_break_layouts()
> 	error: uninitialized symbol 'error'.
> 
> fs/xfs/xfs_inode.c
>     3009 int
>     3010 xfs_break_layouts(
>     3011         struct inode                *inode,
>     3012         uint                        *iolock,
>     3013         enum layout_break_reason reason)
>     3014 {
>     3015         bool                        retry;
>     3016         int                        error;
>     3017 
>     3018         xfs_assert_ilocked(XFS_I(inode), XFS_IOLOCK_SHARED | XFS_IOLOCK_EXCL);
>     3019 
>     3020         do {
>     3021                 retry = false;
>     3022                 switch (reason) {
>     3023                 case BREAK_UNMAP:
>     3024                         if (xfs_break_dax_layouts(inode))
>     3025                                 break;
> 
> What about if we hit this break on the first iteration?

I think that's a bug, thanks for the wakeup, Dan. :)

--D

>     3026                         fallthrough;
>     3027                 case BREAK_WRITE:
>     3028                         error = xfs_break_leased_layouts(inode, iolock, &retry);
>     3029                         break;
>     3030                 default:
>     3031                         WARN_ON_ONCE(1);
>     3032                         error = -EINVAL;
>     3033                 }
> --> 3034         } while (error == 0 && retry);
>     3035 
>     3036         return error;
>     3037 }
> 
> regards,
> dan carpenter
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-10 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10  7:03 [bug report] fs/dax: create a common implementation to break DAX layouts Dan Carpenter
2025-01-10 16:57 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox