From: "E. Abbink" <esger@bumblebeast.com>
To: vda@port.imtp.ilyichevsk.odessa.ua
Cc: linux-kernel@vger.kernel.org
Subject: Re: Problem using mandatory locks (other apps can read/delete etc)
Date: Thu, 11 Apr 2002 11:35:02 +0200 [thread overview]
Message-ID: <200204110935.LAA03761@fikkie.vesc.nl> (raw)
> On 10 April 2002 15:08, E. Abbink wrote:
> > I'm trying to solve a problem using mandatory locks but am having some
> > difficulty in doing so. (if there's a more appropriate place for
> > discussing this please ignore the rest of this post. pointers to that
> > place would be appreciated ;) )
> >
> > my problem:
> >
> > when I lock a file with a mandatory write lock (ie. fcntl, +s-x bits and
> > mand mount option. for code see below) it is still possible:
> >
> > - for me to rm the file in question
> > - for the file to be read by an other process
>
> [snip]
>
> > lock.l_type = F_WRLCK ; <================
> > lock.l_whence = SEEK_SET ;
> > lock.l_start = 0 ;
> > lock.l_len = 0 ;
> > lock.l_pid = 0 ; // ignored
> >
> > int err = fcntl (fd, F_SETLK, &lock) ;
>
> I know nothing about file locking in Unix, but it looks like you
> requested write lock, i.e. forbid writing to a file. Why are you
> surprised that reads are allowed?
>
> Probably someone else would comment on why rm is working, though...
> --
> vda
as i understand it what is called a "write" lock is actually an
exclusive lock (ie both read/write). Also, afaik, you cant set both a
read & write lock through fcntl which supports that assumption.
Esger
--
NeoMail - Webmail that doesn't suck... as much.
http://neomail.sourceforge.net
next reply other threads:[~2002-04-11 8:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-11 9:35 E. Abbink [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-04-12 9:22 E. Abbink
2002-04-10 17:08 E. Abbink
2002-04-11 11:37 ` Denis Vlasenko
2002-04-11 15:42 ` Alex Riesen
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=200204110935.LAA03761@fikkie.vesc.nl \
--to=esger@bumblebeast.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vda@port.imtp.ilyichevsk.odessa.ua \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®