All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: kusumi.tomohiro@gmail.com
Cc: fio@vger.kernel.org, Tomohiro Kusumi <tkusumi@tuxera.com>
Subject: Re: [PATCH 5/6] Acquire file ->lock while the lock itself is being copied
Date: Mon, 13 Feb 2017 12:49:10 -0700	[thread overview]
Message-ID: <20170213194910.GA21482@kernel.dk> (raw)
In-Reply-To: <20170213163239.46188-5-tkusumi@tuxera.com>

On Mon, Feb 13 2017, kusumi.tomohiro@gmail.com wrote:
> From: Tomohiro Kusumi <tkusumi@tuxera.com>
> 
> to the destination file pointer.
> The ones in dup_files() doesn't seem to require locking from
> the way it's been called.
> 
> Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
> ---
>  filesetup.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/filesetup.c b/filesetup.c
> index 3fa8b32..7a67fe6 100644
> --- a/filesetup.c
> +++ b/filesetup.c
> @@ -501,9 +501,11 @@ int file_lookup_open(struct fio_file *f, int flags)
>  	if (__f) {
>  		dprint(FD_FILE, "found file in hash %s\n", f->file_name);
>  		/*
> -		 * racy, need the __f->lock locked
> +		 * get __f->lock while it gets copied to f.
>  		 */
> +		fio_mutex_down(__f->lock);
>  		f->lock = __f->lock;
> +		fio_mutex_up(__f->lock);
>  		from_hash = 1;

What if the file lock mode is FILE_LOCK_READWRITE?

-- 
Jens Axboe



  reply	other threads:[~2017-02-13 19:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 16:32 [PATCH 1/6] configure: Drop default CONFIG_LITTLE_ENDIAN for Cygwin kusumi.tomohiro
2017-02-13 16:32 ` [PATCH 2/6] configure: Use x86 instead of i386 for $cpu for IA32 kusumi.tomohiro
2017-02-13 19:24   ` Elliott, Robert (Persistent Memory)
2017-02-13 19:34     ` Tomohiro Kusumi
2017-02-13 16:32 ` [PATCH 3/6] Drop conditional declaration of disk_list kusumi.tomohiro
2017-02-13 16:32 ` [PATCH 4/6] Always set ->real_file_size to -1 when failed to get file size kusumi.tomohiro
2017-02-13 16:32 ` [PATCH 5/6] Acquire file ->lock while the lock itself is being copied kusumi.tomohiro
2017-02-13 19:49   ` Jens Axboe [this message]
2017-02-13 20:03     ` Tomohiro Kusumi
2017-02-13 16:32 ` [PATCH 6/6] Add missing "rand"/"trimwrite" strings to corresponding ddir slots kusumi.tomohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170213194910.GA21482@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=kusumi.tomohiro@gmail.com \
    --cc=tkusumi@tuxera.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.