[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1612021211050.4295@nanos>
Date: Fri, 2 Dec 2016 12:20:29 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: Marcelo Tosatti <mtosatti@...hat.com>
cc: Fenghua Yu <fenghua.yu@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] intelrdt: resctrl: recommend locking for resctrlfs
On Thu, 1 Dec 2016, Marcelo Tosatti wrote:
>
> There is a locking problem between different applications
> reading/writing to resctrlfs directory at the same time (read the patch
> below for details).
>
> Suggest a standard locking scheme for applications to use.
....
> +To coordinate atomic operations on resctrl and avoid the problem
> +above, the following locking procedure is recommended:
> +
> +A) open /var/lock/resctrl/fs.lock with O_CREAT|O_EXCL.
> +B) if success, write pid of program accessing the directory
> + structure to this file.
> +C) read/write the directory structure.
> +D) remove file.
What's wrong with using flock, which works from shell scripts as well?
Thanks,
tglx
Powered by blists - more mailing lists