xfs
[Top] [All Lists]

Re: [PATCH 1/3] xfs: add RWF_NONBLOCK support

To: Christoph Hellwig <hch@xxxxxx>
Subject: Re: [PATCH 1/3] xfs: add RWF_NONBLOCK support
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 2 Oct 2014 08:23:27 +1000
Cc: Milosz Tanski <milosz@xxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1412197494-7655-2-git-send-email-hch@xxxxxx>
References: <1412197494-7655-1-git-send-email-hch@xxxxxx> <1412197494-7655-2-git-send-email-hch@xxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, Oct 01, 2014 at 11:04:52PM +0200, Christoph Hellwig wrote:
> Add support for non-blocking reads.  The guts are handled by the generic
> code, the only addition is a non-blocking variant of xfs_rw_ilock.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  fs/xfs/xfs_file.c | 30 +++++++++++++++++++++++++-----
>  1 file changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index cf61271..f9efffc 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -61,6 +61,23 @@ xfs_rw_ilock(
>       xfs_ilock(ip, type);
>  }
>  
> +static inline bool
> +xfs_rw_ilock_nowait(
> +     struct xfs_inode        *ip,
> +     int                     type)
> +{
> +     if (type & XFS_IOLOCK_EXCL) {
> +             if (!mutex_trylock(&VFS_I(ip)->i_mutex))
> +                     return false;
> +     }
> +     if (!xfs_ilock_nowait(ip, type)) {
> +             mutex_unlock(&VFS_I(ip)->i_mutex);

Shouldn't that be:

                if (type & XFS_IOLOCK_EXCL) {
                        mutex_unlock(&VFS_I(ip)->i_mutex);

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>