Date: Mon, 1 Aug 2005 18:35:31 -0700 (PDT) From: Matthew Dillon <dillon@apollo.backplane.com> To: Igor Shmukler <igor.shmukler@gmail.com> Cc: hackers@freebsd.org, fs@freebsd.org Subject: Re: per file lock list Message-ID: <200508020135.j721ZVpf035931@apollo.backplane.com> References: <6533c1c9050721121030016b7d@mail.gmail.com> <200507211926.j6LJQ55D071115@apollo.backplane.com> <6533c1c905080111026f1f07ca@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
: :Matt, : :Thank you very much for response. This is a general solution, but it :not sufficient for our needs. I guess I should have been more clear :while explaining what we need. : :We want list of these locks for a group of processes. : :We made an implementation based on your suggestion, but there is one problem... : :Unfortunately this method does not return all shared locks for a :range. For example, if several processes have placed a shared lock on :a :range [1000 - 2000], F_GETLK returns a flock structure where l_pid field :contains a pid of process that takes the lock first. While, we want :to know all processes that takes this lock. Is there any way to retrieve :such information without using of internal kernel structures (inode :information)? : :Thank you in advance, : :igor I'm pretty sure there is no way to get a list of all shared users of a particular lock range short of going through kmem. You would need to program a new fcntl feature to get access to all the related locks. If you need the information just for debugging purposes then scanning the list via kmem might suffice, but it obviously isn't the best solution due to races. What I would recommend is that you create a new fcntl, say call it F_GETLKM, and hand it an extended flock structure which contains additional information...an index and a chaining field that the kernel can use to safely sequence through all related locks. That would allow the kernel to detect races with other processes changing the locking state at the same time. -Matt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508020135.j721ZVpf035931>