[linux-cifs-client] mkstemp fails on cifs linux-2.6.31-rc1 / samba-3.3.6

Jeff Layton jlayton at samba.org
Tue Jun 30 16:58:13 GMT 2009


On Tue, 2009-06-30 at 08:44 -0500, Shirish Pargaonkar wrote:
> On Tue, Jun 30, 2009 at 6:00 AM, Wilhelm Meier<wilhelm.meier at fh-kl.de> wrote:
> > Hi,
> >
> > I made a simple test with cifs in linux-2.6.31-rc1 to see if the so called
> > kmail-problem (cifs-user-homes are totally unusable for kmail-mail-cache)
> > still remains. Than I ran into a strange problem using "sed -i <command> <file-
> > on-cifs>". "sed" uses mkstemp libc-funktion and fails with EEXIST, writing
> > therefore tons of files onto the cifs-share.
> >
> > You can reproduce it with:
> >
> > strace mktemp -p . abcXXXXXX 2>&1 | more
> >
> > giving
> >
> > stat64(".", {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0
> > open("./abcUJcKWM", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)
> > stat64(".", {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0
> > open("./abcUGJaiA", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)
> > stat64(".", {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0
> > open("./abcWfKacs", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)
> > stat64(".", {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0
> > open("./abcBaGjWM", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EEXIST (File exists)
> >
> > This is the same on 2.6.31-rc1-git6.
> >
> > This is not the case in 2.6.26-2-vserver-686 (debian).
> >
> > The Samba-Server is lenny with samba-enterprise:
> > kmux-fs:/# dpkg -l | grep samba
> > ii  sernet-samba                    3.3.6-24                 a LanManager-like
> > file and printer server fo
> > ii  sernet-samba-common             3.3.6-24                 Samba common files
> > used by both the server a
> > ii  sernet-samba-keyring            1.1                      GnuPG archive
> > keys of the SerNet Samba archi
> >
> > If I change Samba to the lenny-version
> >
> > ii  samba                           2:3.2.5-4lenny6          a LanManager-like
> > file and printer server fo
> > ii  samba-common                    2:3.2.5-4lenny6          Samba common files
> > used by both the server a
> >
> > the described test-case is fine.
> >
> >
> > --
> > Wilhelm
> >
> > _______________________________________________
> > linux-cifs-client mailing list
> > linux-cifs-client at lists.samba.org
> > https://lists.samba.org/mailman/listinfo/linux-cifs-client
> >
> 
> Wilhelm,
> 
> How exactly can I recreate the problem?  You mount a Samba share and
> create files and then run
>  mktemp -p . <list_of_files> 2>&1 | more
> 
> I have not dealt with mktemp command, will spend more time later in
> the afternoon.
> 
> Need to address Jeff's comments/concerns about exclusive create too.
> 

I was able to reproduce it by just running this while cd'ed into the
share:
$ strace mktemp -p . abcXXXXXX

You'll see it go into a near infinite loop trying to create different
filenames. Each one returns -EEXIST. I'm pretty sure the O_EXCL flag is
related to the problem since mktemp uses that.

-- 
Jeff Layton <jlayton at samba.org>



More information about the linux-cifs-client mailing list