FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Sun Nov 29, 2020 01:12



Post new topic Reply to topic  [ 20 posts ] 
open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10 
Author Message

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Hi!

I try to use ntfs-3g under Solaris 10 OS:

$ uname -a
SunOS kisa 5.10 Generic_144501-19 i86pc i386 i86pc
$ isainfo -x
amd64: cx16 sse3 sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu
i386: cx16 sse3 sse2 sse fxsr mmx cmov sep cx8 tsc fpu

1) I use "FUSE on OpenSolaris" from
http://hub.opensolaris.org/bin/view/Project+fuse/WebHome

I needed to make libfuse/err.c, libfuse/mkdtemp.c,
libfuse/include/err.h and libfuse/lint.h to compile libfuse.

I needed to change makefiles in the project.

I also needed to change:

fusefs/kernel/fuse_vfsops.c
fusefs/kernel/fuse_vnops.c

libfuse/mount_util.c

because kernel structure in Solaris 10 are slightly different vs.
OpenSolaris.

I have patch file and I can show it if you ask.

I install kernel module and fuse package into /tmp, to avoid booting
problem due to errors in experiments.

2) I use ntfs-3g_ntfsprogs-2011.4.12 with --with-fuse=external

To translate ntfsprogs I use:

$ diff Makefile.in Makefile.in.save
43c43
< @ENABLE_NTFSPROGS_TRUE@ ntfsresize$(EXEEXT) \
---
> @ENABLE_NTFSPROGS_TRUE@ ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) \
$ diff ntfsresize.c ntfsresize.c.save
54,56d53
< #ifdef HAVE_LIMITS_H
< #include <limits.h>
< #endif
$

Thus only ntfsclone don't build. I see it later.

I also need to make:

$ diff src/ntfs-3g_common.c src/ntfs-3g_common.c.save
39,42d38
< #ifdef HAVE_LIMITS_H
< #include <limits.h>
< #endif
<
65c61
< //#ifdef HAVE_SETXATTR
---
> #ifdef HAVE_SETXATTR
678c674
< //#endif /* HAVE_SETXATTR */
---
> #endif /* HAVE_SETXATTR */
$

After all I have the following files structure:

$ find /tmp/fuse -print
/tmp/fuse
/tmp/fuse/usr
/tmp/fuse/usr/bin
/tmp/fuse/usr/bin/fusermount
/tmp/fuse/usr/bin/ntfs-3g
/tmp/fuse/usr/bin/lowntfs-3g
/tmp/fuse/usr/lib
/tmp/fuse/usr/lib/pkgconfig
/tmp/fuse/usr/lib/pkgconfig/fuse.pc
/tmp/fuse/usr/lib/fs
/tmp/fuse/usr/lib/fs/fuse
/tmp/fuse/usr/lib/fs/fuse/fusermount.bin
/tmp/fuse/usr/lib/fs/fuse/mount
/tmp/fuse/usr/lib/fs/fuse/umount
/tmp/fuse/usr/lib/libfuse.so.2.7.1
/tmp/fuse/usr/lib/libfuse.so.2
/tmp/fuse/usr/lib/libfuse.so
/tmp/fuse/usr/lib/libntfs-3g.so
/tmp/fuse/usr/lib/libntfs-3g.so.81
/tmp/fuse/usr/lib/libntfs-3g.so.81.0.0
/tmp/fuse/usr/include
/tmp/fuse/usr/include/fuse
/tmp/fuse/usr/include/fuse/fuse.h
/tmp/fuse/usr/include/fuse/fuse_common.h
/tmp/fuse/usr/include/fuse/fuse_common_compat.h
/tmp/fuse/usr/include/fuse/fuse_lowlevel.h
/tmp/fuse/usr/include/fuse/fuse_lowlevel_compat.h
/tmp/fuse/usr/include/fuse/fuse_opt.h
/tmp/fuse/usr/sbin
/tmp/fuse/usr/sbin/mkfs.ntfs
/tmp/fuse/usr/local
/tmp/fuse/usr/local/include
/tmp/fuse/usr/local/include/ntfs-3g
/tmp/fuse/usr/local/include/ntfs-3g/acls.h
...
/tmp/fuse/usr/local/include/ntfs-3g/xattrs.h
/tmp/fuse/usr/local/lib
/tmp/fuse/usr/local/lib/libntfs-3g.la
/tmp/fuse/usr/local/lib/libntfs-3g.a
/tmp/fuse/usr/local/lib/pkgconfig
/tmp/fuse/usr/local/lib/pkgconfig/libntfs-3g.pc
/tmp/fuse/usr/local/lib/libntfs-3g.so
/tmp/fuse/usr/local/bin
/tmp/fuse/usr/local/bin/ntfsfix
/tmp/fuse/usr/local/bin/ntfsinfo
/tmp/fuse/usr/local/bin/ntfscluster
/tmp/fuse/usr/local/bin/ntfsls
/tmp/fuse/usr/local/bin/ntfscat
/tmp/fuse/usr/local/bin/ntfscmp
/tmp/fuse/usr/local/bin/ntfs-3g.probe
/tmp/fuse/usr/local/bin/ntfs-3g.usermap
/tmp/fuse/usr/local/bin/ntfs-3g.secaudit
/tmp/fuse/usr/local/sbin
/tmp/fuse/usr/local/sbin/mkntfs
/tmp/fuse/usr/local/sbin/ntfslabel
/tmp/fuse/usr/local/sbin/ntfsundelete
/tmp/fuse/usr/local/sbin/ntfsresize
/tmp/fuse/usr/local/sbin/ntfscp
/tmp/fuse/usr/local/share
/tmp/fuse/usr/local/share/man
/tmp/fuse/usr/local/share/man/man8
/tmp/fuse/usr/local/share/man/man8/mkntfs.8
...
/tmp/fuse/usr/local/share/man/man8/mount.lowntfs-3g.8
/tmp/fuse/usr/local/share/doc
/tmp/fuse/usr/local/share/doc/ntfs-3g
/tmp/fuse/usr/local/share/doc/ntfs-3g/README
$

=================================================

The problem is:

If I use system call "open" as

k = open("testfile", O_RDWR | O_CREAT | O_TRUNC, 0666);

if "testfile" exists in file system I obtain:

a) under Solaris and ufs:
file opens and it's length is equal 0

b) under Windows XP and ntfs:
file opens and it's length is equal 0

c) under Solaris and ntfs (mount via ntfs-3g):
"Err#17 EEXIST" - file exists error.

System call "creat" (which is equal "open" above) also works wrong.

Thus some application don't work.

How to repair?


Mon Aug 15, 2011 20:56
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
/mnt/C is on ntfs file system, mounted via ntfs-3g:

# /tmp/fuse/usr/bin/ntfs-3g -o uid=1001,gid=1000 /dev/dsk/c4t0d0p0 /mnt

# ls /mnt
20100317
20100402
20100423
ABIT-AL8-drivers
al819
BOOTEX.LOG
C
home.tgz
homepage
homepage.html
IMG_0017.JPG
mathematics
memory.tgz
NewDocument
NewFolder
Nokia
PUTTY.EXE
software
абаИаМаЕб аИаМаЕаНаИ аКаАбаАаЛаОаГаА
абаИаМаЕб аИаМаЕаНаИ баАаЙаЛаА
#

# cd "/mnt/`echo \"Пример имени каталога\"|iconv -fiso5 -tutf-8`"
# pwd
/mnt/абаИаМаЕб аИаМаЕаНаИ аКаАбаАаЛаОаГаА
#

# cd /d0/root/SOURCES/ntfs-3g/test

# pwd
/d0/root/SOURCES/ntfs-3g/test
# df -k | grep /d0
/dev/dsk/c0d0s3 40329203 39070939 854972 98% /d0
# fstyp /dev/dsk/c0d0s3
ufs
#

Copy from usf to ntfs:

# truss -vall -efal cp -p a.c /mnt/C/b.c 2>&1 | grep 'b\.c'
24237/1: argv: cp -p a.c /mnt/C/b.c
24237/1: stat64("/mnt/C/b.c", 0x08066370) = 0
24237/1: stat64("/mnt/C/b.c", 0x08066370) = 0
24237/1: creat64("/mnt/C/b.c", 0644) Err#17 EEXIST
#
# truss -vall -efal cp -pf a.c /mnt/C/b.c 2>&1 | grep 'b\.c'
24240/1: argv: cp -pf a.c /mnt/C/b.c
24240/1: stat64("/mnt/C/b.c", 0x08066370) = 0
24240/1: stat64("/mnt/C/b.c", 0x08066370) = 0
24240/1: creat64("/mnt/C/b.c", 0644) Err#17 EEXIST
24240/1: unlink("/mnt/C/b.c") = 0
24240/1: creat64("/mnt/C/b.c", 0644) = 4
24240/1: stat64("/mnt/C/b.c", 0x08066370) = 0
24240/1: chmod("/mnt/C/b.c", 0100644) = 0
24240/1: chown("/mnt/C/b.c", 1001, 1000) = 0
24240/1: chmod("/mnt/C/b.c", 0100644) = 0
24240/1: utimensat(-3041965, "/mnt/C/b.c", 0x080467DC, 0) = 0
#

Copy from ufs to ufs:

# truss -vall -efal cp -p a.c b.c 2>&1 | grep 'b\.c'
24243/1: argv: cp -p a.c b.c
24243/1: stat64("b.c", 0x08066370) = 0
24243/1: stat64("b.c", 0x08066370) = 0
24243/1: creat64("b.c", 0644) = 4
24243/1: stat64("b.c", 0x08066370) = 0
24243/1: chmod("b.c", 0100644) = 0
24243/1: chown("b.c", 1001, 1000) = 0
24243/1: chmod("b.c", 0100644) = 0
24243/1: utimensat(-3041965, "b.c", 0x080467E4, 0) = 0
#
#
# truss -vall -efal cp -pf a.c b.c 2>&1 | grep 'b\.c'
24246/1: argv: cp -pf a.c b.c
24246/1: stat64("b.c", 0x08066370) = 0
24246/1: stat64("b.c", 0x08066370) = 0
24246/1: creat64("b.c", 0644) = 4
24246/1: stat64("b.c", 0x08066370) = 0
24246/1: chmod("b.c", 0100644) = 0
24246/1: chown("b.c", 1001, 1000) = 0
24246/1: chmod("b.c", 0100644) = 0
24246/1: utimensat(-3041965, "b.c", 0x080467E4, 0) = 0
#

Where is a problem: in "fuse" or in "ntfs-3g"?


Tue Aug 16, 2011 15:22
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
# /tmp/fuse/usr/bin/ntfs-3g -help

ntfs-3g 2011.4.12 external FUSE 27 - Third Generation NTFS Driver
Configuration type 1, XATTRS are off, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2011 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage: ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options: ro (read-only mount), remove_hiberfile, uid=, gid=,
umask=, fmask=, dmask=, streams_interface=.
Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

News, support and information: http://tuxera.com
#

I installed "ntfs-3g 2010.10.2":

# /tmp/fuse/usr/bin/ntfs-3g -help

ntfs-3g 2010.10.2 external FUSE 27 - Third Generation NTFS Driver
Configuration type 1, XATTRS are off, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2010 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage: ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options: ro (read-only mount), remove_hiberfile, uid=, gid=,
umask=, fmask=, dmask=, streams_interface=.
Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

Ntfs-3g news, support and information: http://ntfs-3g.org
#

I obtained the same results:

# truss -vall -efal cp -p a.c /mnt/C/b.c 2>&1 | grep 'b\.c'
29665/1: argv: cp -p a.c /mnt/C/b.c
29665/1: stat64("/mnt/C/b.c", 0x08066370) = 0
29665/1: stat64("/mnt/C/b.c", 0x08066370) = 0
29665/1: creat64("/mnt/C/b.c", 0644) Err#17 EEXIST
/mnt/C/b.c29665/1: write(2, " / m n t / C / b . c", 10) = 10
#
# truss -vall -efal cp -pf a.c /mnt/C/b.c 2>&1 | grep 'b\.c'
29684/1: argv: cp -pf a.c /mnt/C/b.c
29684/1: stat64("/mnt/C/b.c", 0x08066370) = 0
29684/1: stat64("/mnt/C/b.c", 0x08066370) = 0
29684/1: creat64("/mnt/C/b.c", 0644) Err#17 EEXIST
29684/1: unlink("/mnt/C/b.c") = 0
29684/1: creat64("/mnt/C/b.c", 0644) = 4
29684/1: stat64("/mnt/C/b.c", 0x08066370) = 0
29684/1: chmod("/mnt/C/b.c", 0100644) = 0
29684/1: chown("/mnt/C/b.c", 1001, 1000) = 0
29684/1: chmod("/mnt/C/b.c", 0100644) = 0
29684/1: utimensat(-3041965, "/mnt/C/b.c", 0x080467DC, 0) = 0
#

But I found one more error.

Under old "ntfs-3g 2010.10.2":

# df -h | egrep 'Mounted on|/mnt'
Filesystem size used avail capacity Mounted on
mnttab 0K 0K 0K 0% /etc/mnttab
/dev/dsk/c4t0d0p0 952M 518M 435M 55% /mnt
#

Under new "ntfs-3g 2011.4.12":

# df -h | egrep 'Mounted on|/mnt'
Filesystem size used avail capacity Mounted on
mnttab 0K 0K 0K 0% /etc/mnttab
/devices/pci@0 952M 518M 435M 55% /mnt
#

This is not good. In this case I can't find device with a help mnttab.

# ls -l /dev/dsk/c4t0d0p0
lrwxrwxrwx 1 root root 60 авг. 15 10:58 /dev/dsk/c4t0d0p0 -> ../../devices/pci@0,0/pci147b,105e@1d,7/storage@5/disk@0,0:q
#

# mount | grep "^/mnt"
/mnt on /devices/pci@0 read/write/nosetuid/nodevices/rstchown/dev=2fc0000 on Вт авг. 16 18:06:55 2011
#


Tue Aug 16, 2011 16:20
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
You can find attached trace logs for

cp -f a.c /mnt/C/b.c

and

cp a.c /mnt/C/b.c

After this logs investigation I think that this is "ntfs-3g"
feature...

How to repair?


Attachments:
truss.tgz [3.09 KiB]
Downloaded 1106 times
Tue Aug 16, 2011 17:56
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Hi,

Quote:
I needed to change makefiles in the project.
I also needed to change:
fusefs/kernel/fuse_vfsops.c
fusefs/kernel/fuse_vnops.c
libfuse/mount_util.c
because kernel structure in Solaris 10 are slightly different vs. OpenSolaris.

You should post your changes so that they can be used and checked by other users...
Quote:
To translate ntfsprogs I use:

The recent advanced ntfs-3g version contained patches for OpenIndiana, which are much similar to the ones you made.
Quote:
k = open("testfile", O_RDWR | O_CREAT | O_TRUNC, 0666);
) under Solaris and ntfs (mount via ntfs-3g):
"Err#17 EEXIST" - file exists error

On Linux I get the expected behavior. Please mount with debug option :
Code:
# may have to be adapted to Solaris
ntfs-3g -o debug device mountpoint 2> ntfs-3g.log


Quote:
Copy from usf to ntfs:
24240/1: creat64("/mnt/C/b.c", 0644) Err#17 EEXIST

Copy from ufs to ufs:
24243/1: creat64("b.c", 0644) = 4

What do you get when opening WRONLY ? open("testfile", O_WRONLY | O_CREAT | O_TRUNC, 0666);

Quote:
Under old "ntfs-3g 2010.10.2":
/dev/dsk/c4t0d0p0 952M 518M 435M 55% /mnt

Under new "ntfs-3g 2011.4.12":
/devices/pci@0 952M 518M 435M 55% /mnt

This is not good. In this case I can't find device with a help mnttab.

I cannot find a reason within ntfs-3g for this change of behavior. Is everything else the same in these configurations ? A change was made in 2011.4.12AR.1 for something similar. Does that help ?

Note : I do not have Solaris myself, I may have to ask you to apply temporary patches to debug further. First try to mount with debug option.

Regards

Jean-Pierre


Wed Aug 17, 2011 11:18
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
1> You should post your changes so that they can be used and checked by
1> other users...

I will make it as soon as possible as single file with scripts.

But:

To compile kernel module (fuse) user must have:

$ /opt/SUNWspro/bin/cc -V
cc: Sun C 5.9 SunOS_i386 Patch 124868-15 2010/08/11
usage: cc [ options] files. Use 'cc -flags' for details
$

because gcc is not fully compatible with Solaris kernel's source
code. To rewrite it for gcc is too complex and scary.

To compile the other parts of package user can use gcc and gmake
from Solaris 10 distribution:

$ gcc --version
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gmake --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-pc-solaris2.10
$

-------------------------------------------------------------

2> What do you get when opening WRONLY ? open("testfile", O_WRONLY | O_CREAT | O_TRUNC, 0666);

You can find attached debug_log-1.txt from the following:

$ ls -l /mnt/b.c
/mnt/b.c: No such file or directory
$ ls -l /mnt/C/b.c
-rwxrwxrwx 1 vitaly users 707 авг. 16 19:16 /mnt/C/b.c
$ cp a.c /mnt/C/b.c
cp: cannot create /mnt/C/b.c: File exists
$ cp -f a.c /mnt/C/b.c
$ ls -l /mnt/C/b.c
-rwxrwxrwx 1 vitaly users 707 авг. 17 15:55 /mnt/C/b.c
$

Please investigate trace log which attached to my previous message.
You can see functions from shared libraries (libfuse.so.2.7.1 and
libntfs-3g.so.81.0.0) calls in it.

-------------------------------------------------------------

3> I cannot find a reason within ntfs-3g for this change of behavior.
3> Is everything else the same in these configurations ? A change was made
3> in 2011.4.12AR.1 for something similar. Does that help ?

May be I have made some changes in old version and forgot about it? I
will see diff. I tried old version in Dec 2010. Regularly I use
mount_ntfs program which gives me RO access.


Attachments:
debug_log-1.tgz [1.59 KiB]
Downloaded 1102 times
Wed Aug 17, 2011 14:30
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
2> What do you get when opening WRONLY ? open("testfile", O_WRONLY | O_CREAT | O_TRUNC, 0666);
Code:
------------------------------------------------------------------
// gcc -Wall -o a a.c

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef _SOLARIS_
#include <sys/uio.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

char *s = "STRING 1\n";

int main(int argc, char *argv[])
{
    int k;

    if (argc < 2) {
   printf("%s <filename>\n", argv[0]);
   printf("create file and write to it\n");
   exit(0);
    }

    k = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0666);
    printf("\"open\" return value = %d\n", k);
    if (k < 0) {
   perror("");
   exit(1);
    }

    k = write(k, s, strlen(s));
    printf("\"write\" return value = %d\n", k);
    if (k < 0) {
   perror("");
   exit(1);
    }

    close(k);
    exit(0);
}
------------------------------------------------------------------

$ gcc -Wall -o a a.c
$ ls -l /mnt/C/b.c
-rwxrwxrwx   1 vitaly   users        707 авг. 17 15:55 /mnt/C/b.c
$ ./a /mnt/C/b.c
"open" return value = -1
File exists
$

------------------------------------------------------------------

unique: 84, opcode: ACCESS (34), nodeid: 1, insize: 48
ACCESS / 01
   unique: 84, error: -89 (Operation not applicable), outsize: 16
unique: 85, opcode: LOOKUP (1), nodeid: 1, insize: 42
LOOKUP /C
   NODEID: 2
   unique: 85, error: 0 (Error 0), outsize: 136
unique: 86, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /C/b.c
   NODEID: 4
   unique: 86, error: 0 (Error 0), outsize: 136
unique: 87, opcode: GETATTR (3), nodeid: 4, insize: 40
   unique: 87, error: 0 (Error 0), outsize: 112
unique: 88, opcode: ACCESS (34), nodeid: 1, insize: 48
ACCESS / 01
   unique: 88, error: -89 (Operation not applicable), outsize: 16
unique: 89, opcode: LOOKUP (1), nodeid: 1, insize: 42
LOOKUP /C
   NODEID: 2
   unique: 89, error: 0 (Error 0), outsize: 136
unique: 90, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /C/b.c
   NODEID: 4
   unique: 90, error: 0 (Error 0), outsize: 136
unique: 91, opcode: ACCESS (34), nodeid: 1, insize: 48
ACCESS / 01
   unique: 91, error: -89 (Operation not applicable), outsize: 16
unique: 92, opcode: LOOKUP (1), nodeid: 1, insize: 42
LOOKUP /C
   NODEID: 2
   unique: 92, error: 0 (Error 0), outsize: 136
unique: 93, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /C/b.c
   NODEID: 4
   unique: 93, error: 0 (Error 0), outsize: 136
unique: 94, opcode: GETATTR (3), nodeid: 4, insize: 40
   unique: 94, error: 0 (Error 0), outsize: 112
unique: 95, opcode: ACCESS (34), nodeid: 1, insize: 48
ACCESS / 01
   unique: 95, error: -89 (Operation not applicable), outsize: 16
unique: 96, opcode: LOOKUP (1), nodeid: 1, insize: 42
LOOKUP /C
   NODEID: 2
   unique: 96, error: 0 (Error 0), outsize: 136
unique: 97, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /C/b.c
   NODEID: 4
   unique: 97, error: 0 (Error 0), outsize: 136
unique: 98, opcode: GETATTR (3), nodeid: 4, insize: 40
   unique: 98, error: 0 (Error 0), outsize: 112
unique: 99, opcode: ACCESS (34), nodeid: 1, insize: 48
ACCESS / 01
   unique: 99, error: -89 (Operation not applicable), outsize: 16
unique: 100, opcode: LOOKUP (1), nodeid: 1, insize: 42
LOOKUP /C
   NODEID: 2
   unique: 100, error: 0 (Error 0), outsize: 136
unique: 101, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /C/b.c
   NODEID: 4
   unique: 101, error: 0 (Error 0), outsize: 136
unique: 102, opcode: GETATTR (3), nodeid: 4, insize: 40
   unique: 102, error: 0 (Error 0), outsize: 112
unique: 103, opcode: ACCESS (34), nodeid: 1, insize: 48
ACCESS / 01
   unique: 103, error: -89 (Operation not applicable), outsize: 16
unique: 104, opcode: LOOKUP (1), nodeid: 1, insize: 42
LOOKUP /C
   NODEID: 2
   unique: 104, error: 0 (Error 0), outsize: 136
unique: 105, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /C/b.c
   NODEID: 4
   unique: 105, error: 0 (Error 0), outsize: 136
unique: 106, opcode: GETATTR (3), nodeid: 2, insize: 40
   unique: 106, error: 0 (Error 0), outsize: 112
unique: 107, opcode: GETATTR (3), nodeid: 4, insize: 40
   unique: 107, error: 0 (Error 0), outsize: 112
unique: 108, opcode: CREATE (35), nodeid: 2, insize: 53
Index already have such entry: File exists
Failed to add entry to the index: File exists
   unique: 108, error: -17 (File exists), outsize: 16


Wed Aug 17, 2011 14:51
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
The same under ufs:

$ pwd
/d0/root/SOURCES/ntfs-3g/test
$ df -h | grep /d0
/dev/dsk/c0d0s3 38G 37G 835M 98% /d0
$ su
Password:
# fstyp /dev/dsk/c0d0s3
ufs
# exit
$ ls -l b.c
-rw-r--r-- 1 vitaly users 709 авг. 17 16:42 b.c
$ ./a b.c
"open" return value = 3
"write" return value = 9
$ ls -l b.c
-rw-r--r-- 1 vitaly users 9 авг. 17 16:53 b.c
$


Wed Aug 17, 2011 15:25
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Hi,

Code:
unique: 105, opcode: LOOKUP (1), nodeid: 2, insize: 44
LOOKUP /C/b.c
   NODEID: 4
   unique: 105, error: 0 (Error 0), outsize: 136
unique: 106, opcode: GETATTR (3), nodeid: 2, insize: 40
   unique: 106, error: 0 (Error 0), outsize: 112
unique: 107, opcode: GETATTR (3), nodeid: 4, insize: 40
   unique: 107, error: 0 (Error 0), outsize: 112
unique: 108, opcode: CREATE (35), nodeid: 2, insize: 53
Index already have such entry: File exists
Failed to add entry to the index: File exists
   unique: 108, error: -17 (File exists), outsize: 16

This CREATE is wrong : the LOOKUP is there to check whether /C/b.c already exists. The reply with code 0 means it does exist. Then there are GETATTR to check whether it is writeable with a positive reply. With that conditions there should be an OPEN instead of a CREATE. The CREATE is rightfully rejected because the file exists.

This behavior is caused by ntfs-3g getting called in wrong conditions.

I would first check the patches you applied when porting to Solaris (I do not have enough knowledge of Solaris for such checks). Is there anything related to file creation ?

Regards

Jean-Pierre


Wed Aug 17, 2011 16:00
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Please load all packages as single catalog "ntfs-3g".

File ntfs-3g.solaris10.tgz (3399257 bytes).

URL for download: http://files.mail.ru/LIVID8
File will be stored till September 16, 2011, every download will prolong storage period for 30 days.

Read README file.

Sub-catalogs fuse_solaris and ntfs-3g_ntfsprogs-2011.4.12 have all patches applying.


Wed Aug 17, 2011 20:20
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
> 3> I cannot find a reason within ntfs-3g for this change of behavior.
> 3> Is everything else the same in these configurations ? A change was made
> 3> in 2011.4.12AR.1 for something similar. Does that help ?

> May be I have made some changes in old version and forgot about it? I
> will see diff. I tried old version in Dec 2010. Regularly I use
> mount_ntfs program which gives me RO access.

Yes. I have made patch to obtain more suitable output. I forgot about it.
Code:
---- ntfs-3g_common.h.patch90 cut here ----
*** src/ntfs-3g_common.h%   Чт авг. 18 16:09:19 2011
--- src/ntfs-3g_common.h   Чт авг. 18 16:09:19 2011
***************
*** 29,34 ****
--- 29,35 ----
          char    *mnt_point;     /* Mount point */   
          char    *options;       /* Mount options */ 
          char    *device;        /* Device to mount */
+    char   *show_device;   /* Special file name (e.g. under /dev) */
  } ;
 
  typedef enum {
---- ntfs-3g_common.h.patch90 cut here ----

---- ntfs-3g_common.c.patch90 cut here ----
*** src/ntfs-3g_common.c%   Чт авг. 18 17:26:02 2011
--- src/ntfs-3g_common.c   Чт авг. 18 17:27:32 2011
***************
*** 43,48 ****
--- 43,49 ----
  #include <getopt.h>
  #include <fuse.h>
 
+ #include "compat.h"
  #include "inode.h"
  #include "security.h"
  #include "xattrs.h"
***************
*** 458,464 ****
     
     if (ntfs_strappend(&ret, "fsname="))
        goto err_exit;
!    if (ntfs_strappend(&ret, popts->device))
        goto err_exit;
     if (permissions && !acl)
        ctx->secure_flags |= (1 << SECURITY_DEFAULT);
--- 459,465 ----
     
     if (ntfs_strappend(&ret, "fsname="))
        goto err_exit;
!    if (ntfs_strappend(&ret, popts->show_device))
        goto err_exit;
     if (permissions && !acl)
        ctx->secure_flags |= (1 << SECURITY_DEFAULT);
***************
*** 516,521 ****
--- 517,526 ----
                 popts->device = NULL;
                 return -1;
              }
+             popts->show_device = ntfs_malloc(PATH_MAX + 1);
+             if (!popts->show_device)
+                return -1;
+             strcpy(popts->show_device, optarg);
           } else if (!popts->mnt_point) {
              popts->mnt_point = optarg;
           } else {
---- ntfs-3g_common.c.patch90 cut here ----


cd ntfs-3g_ntfsprogs-2011.4.12

/usr/bin/patch -i ../ntfs-3g_common.c.patch07
/usr/bin/patch -i ../ntfs-3g_common.c.patch08
/usr/bin/patch -i ../ntfsclone.c.patch08
/usr/bin/patch -i ../ntfsresize.c.patch08

/usr/bin/patch -i ../ntfs-3g_common.h.patch90
/usr/bin/patch -i ../ntfs-3g_common.c.patch90

You can load all packages as single catalog "ntfs-3g" with all patches, objs and bins.

File ntfs-3g.solaris10.tgz (7517020 bytes).

URL for download: http://files.mail.ru/HZ10FU
File will be stored till September 17, 2011, every download will prolong storage period for 30 days.

Read README file.

Sub-catalogs fuse_solaris and ntfs-3g_ntfsprogs-2011.4.12 have all patches applying.


Thu Aug 18, 2011 16:39
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Hi,

Quote:
I have made patch to obtain more suitable output.

Does this also solve opening an existing file ?

In your former system trace, I noticed :
Code:
1745/1:         fxstat(2, 6, 0x08046168)                        = 0
1745/1:             d=0x048C0000 i=17948 m=0020000 l=0  u=0     g=0     rdev=0x$
1745/1:                 at = Aug 16 18:06:55 MSD 2011  [ 1313503615.000000000 ]
1745/1:                 mt = Aug 16 18:06:55 MSD 2011  [ 1313503615.000000000 ]
1745/1:                 ct = Aug 16 18:06:55 MSD 2011  [ 1313503615.000000000 ]
1745/1:             bsz=8192  blks=0     fs=BADVFS

Maybe this return value " fs=BADVFS" might be adversely interpreted somewhere, causing the vfs not to acknowledge the existing file. Moreover you are mounting with "uid=1001,gid=1000", so I would expect stat(2) to return those values. Does "stat(1)" applied to an existing file return correct values ?

Regards

Jean-Pierre


Thu Aug 18, 2011 18:12
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
1> Does this also solve opening an existing file ?

With this patch I have such output (/mnt is mount with a help of ntfs-3g):
Code:
$ df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1d1s0         96G   7,3G    88G     8%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   7,8G   996K   7,8G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                        96G   7,3G    88G     8%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   7,9G    10M   7,8G     1%    /tmp
swap                   7,8G    32K   7,8G     1%    /var/run
/dev/dsk/c2d1s0         48G    22G    25G    48%    /d9
/dev/dsk/c1d1s7        1,7T    21G   1,7T     2%    /d8
/dev/dsk/c0d0s4         38G    36G   2,4G    94%    /d1
/dev/dsk/c0d0s5        3,4G   2,1G   1,3G    61%    /d5
/dev/dsk/c1d0s0         49G    46G   3,5G    93%    /d2
/dev/dsk/c0d0s3         38G    37G   835M    98%    /d0
/dev/dsk/c0d0s7         19G   3,9G    15G    21%    /d7
/dev/dsk/c0d0s0        9,6G   4,1G   5,4G    43%    /d6
/dev/dsk/c1d0p3         32G    23G   8,3G    74%    /disk_e
/dev/dsk/c2d1s7        132G   123G   7,7G    95%    /export/home
127.0.0.1:/            391G   391G     0K   100%    /disk_c
127.0.0.1:/            445G   445G     0K   100%    /disk_d
127.0.0.1:/            391G   391G     0K   100%    /disk_f
127.0.0.1:/            3,3T   3,3T     0K   100%    /disk_g
/dev/dsk/c4t0d0p0      952M   518M   435M    55%    /mnt
$

$ LC_ALL=C /usr/sbin/mount
/ on /dev/dsk/c1d1s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980080 on Thu Aug 18 09:43:48 2011
/devices on /devices read/write/setuid/devices/rstchown/dev=48c0000 on Thu Aug 18 09:43:32 2011
/system/contract on ctfs read/write/setuid/devices/rstchown/dev=4940001 on Thu Aug 18 09:43:32 2011
/proc on proc read/write/setuid/devices/rstchown/dev=4900000 on Thu Aug 18 09:43:32 2011
/etc/mnttab on mnttab read/write/setuid/devices/rstchown/dev=4980001 on Thu Aug 18 09:43:32 2011
/etc/svc/volatile on swap read/write/setuid/devices/rstchown/xattr/dev=49c0001 on Thu Aug 18 09:43:32 2011
/system/object on objfs read/write/setuid/devices/rstchown/dev=4a00001 on Thu Aug 18 09:43:32 2011
/etc/dfs/sharetab on sharefs read/write/setuid/devices/rstchown/dev=4a40001 on Thu Aug 18 09:43:32 2011
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/rstchown/dev=1980080 on Thu Aug 18 09:43:44 2011
/dev/fd on fd read/write/setuid/devices/rstchown/dev=4bc0001 on Thu Aug 18 09:43:48 2011
/tmp on swap read/write/setuid/devices/rstchown/xattr/dev=49c0002 on Thu Aug 18 09:43:53 2011
/var/run on swap read/write/setuid/devices/rstchown/xattr/dev=49c0003 on Thu Aug 18 09:43:53 2011
/d9 on /dev/dsk/c2d1s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=19800c0 on Thu Aug 18 09:43:59 2011
/d8 on /dev/dsk/c1d1s7 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980087 on Thu Aug 18 09:43:59 2011
/d1 on /dev/dsk/c0d0s4 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980104 on Thu Aug 18 09:43:59 2011
/d5 on /dev/dsk/c0d0s5 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980105 on Thu Aug 18 09:43:59 2011
/d2 on /dev/dsk/c1d0s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980040 on Thu Aug 18 09:43:59 2011
/d0 on /dev/dsk/c0d0s3 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980103 on Thu Aug 18 09:43:59 2011
/d7 on /dev/dsk/c0d0s7 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980107 on Thu Aug 18 09:43:59 2011
/d6 on /dev/dsk/c0d0s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980100 on Thu Aug 18 09:43:59 2011
/disk_e on /dev/dsk/c1d0p3 read/write/setuid/devices/rstchown/hidden/nofoldcase/atime/timezone=-10800/dev=1980053 on Thu Aug 18 09:43:59 2011
/export/home on /dev/dsk/c2d1s7 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=19800c7 on Thu Aug 18 09:43:59 2011
/disk_c on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32778/public/vers=2/proto=udp/xattr/dev=4c40001 on Thu Aug 18 09:44:05 2011
/disk_d on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32787/public/vers=2/proto=udp/xattr/dev=4c40002 on Thu Aug 18 09:44:06 2011
/disk_f on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32788/public/vers=2/proto=udp/xattr/dev=4c40003 on Thu Aug 18 09:44:07 2011
/disk_g on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32789/public/vers=2/proto=udp/xattr/dev=4c40004 on Thu Aug 18 09:44:08 2011
/mnt on /dev/dsk/c4t0d0p0 read/write/nosetuid/nodevices/rstchown/dev=2fc0000 on Thu Aug 18 17:50:13 2011
$

Without this patch I have:
Code:
$ df -h
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c1d1s0         96G   7,3G    88G     8%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   7,8G   996K   7,8G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
                        96G   7,3G    88G     8%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   7,9G    10M   7,8G     1%    /tmp
swap                   7,8G    32K   7,8G     1%    /var/run
/dev/dsk/c2d1s0         48G    22G    25G    48%    /d9
/dev/dsk/c1d1s7        1,7T    21G   1,7T     2%    /d8
/dev/dsk/c0d0s4         38G    36G   2,4G    94%    /d1
/dev/dsk/c0d0s5        3,4G   2,1G   1,3G    61%    /d5
/dev/dsk/c1d0s0         49G    46G   3,5G    93%    /d2
/dev/dsk/c0d0s3         38G    37G   835M    98%    /d0
/dev/dsk/c0d0s7         19G   3,9G    15G    21%    /d7
/dev/dsk/c0d0s0        9,6G   4,1G   5,4G    43%    /d6
/dev/dsk/c1d0p3         32G    23G   8,3G    74%    /disk_e
/dev/dsk/c2d1s7        132G   123G   7,7G    95%    /export/home
127.0.0.1:/            391G   391G     0K   100%    /disk_c
127.0.0.1:/            445G   445G     0K   100%    /disk_d
127.0.0.1:/            391G   391G     0K   100%    /disk_f
127.0.0.1:/            3,3T   3,3T     0K   100%    /disk_g
/devices/pci@0         952M   518M   435M    55%    /mnt
$

$ LC_ALL=C /usr/sbin/mount
/ on /dev/dsk/c1d1s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980080 on Thu Aug 18 09:43:48 2011
/devices on /devices read/write/setuid/devices/rstchown/dev=48c0000 on Thu Aug 18 09:43:32 2011
/system/contract on ctfs read/write/setuid/devices/rstchown/dev=4940001 on Thu Aug 18 09:43:32 2011
/proc on proc read/write/setuid/devices/rstchown/dev=4900000 on Thu Aug 18 09:43:32 2011
/etc/mnttab on mnttab read/write/setuid/devices/rstchown/dev=4980001 on Thu Aug 18 09:43:32 2011
/etc/svc/volatile on swap read/write/setuid/devices/rstchown/xattr/dev=49c0001 on Thu Aug 18 09:43:32 2011
/system/object on objfs read/write/setuid/devices/rstchown/dev=4a00001 on Thu Aug 18 09:43:32 2011
/etc/dfs/sharetab on sharefs read/write/setuid/devices/rstchown/dev=4a40001 on Thu Aug 18 09:43:32 2011
/lib/libc.so.1 on /usr/lib/libc/libc_hwcap1.so.1 read/write/setuid/devices/rstchown/dev=1980080 on Thu Aug 18 09:43:44 2011
/dev/fd on fd read/write/setuid/devices/rstchown/dev=4bc0001 on Thu Aug 18 09:43:48 2011
/tmp on swap read/write/setuid/devices/rstchown/xattr/dev=49c0002 on Thu Aug 18 09:43:53 2011
/var/run on swap read/write/setuid/devices/rstchown/xattr/dev=49c0003 on Thu Aug 18 09:43:53 2011
/d9 on /dev/dsk/c2d1s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=19800c0 on Thu Aug 18 09:43:59 2011
/d8 on /dev/dsk/c1d1s7 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980087 on Thu Aug 18 09:43:59 2011
/d1 on /dev/dsk/c0d0s4 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980104 on Thu Aug 18 09:43:59 2011
/d5 on /dev/dsk/c0d0s5 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980105 on Thu Aug 18 09:43:59 2011
/d2 on /dev/dsk/c1d0s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980040 on Thu Aug 18 09:43:59 2011
/d0 on /dev/dsk/c0d0s3 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980103 on Thu Aug 18 09:43:59 2011
/d7 on /dev/dsk/c0d0s7 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980107 on Thu Aug 18 09:43:59 2011
/d6 on /dev/dsk/c0d0s0 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=1980100 on Thu Aug 18 09:43:59 2011
/disk_e on /dev/dsk/c1d0p3 read/write/setuid/devices/rstchown/hidden/nofoldcase/atime/timezone=-10800/dev=1980053 on Thu Aug 18 09:43:59 2011
/export/home on /dev/dsk/c2d1s7 read/write/setuid/devices/rstchown/intr/largefiles/logging/xattr/onerror=panic/dev=19800c7 on Thu Aug 18 09:43:59 2011
/disk_c on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32778/public/vers=2/proto=udp/xattr/dev=4c40001 on Thu Aug 18 09:44:05 2011
/disk_d on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32787/public/vers=2/proto=udp/xattr/dev=4c40002 on Thu Aug 18 09:44:06 2011
/disk_f on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32788/public/vers=2/proto=udp/xattr/dev=4c40003 on Thu Aug 18 09:44:07 2011
/disk_g on 127.0.0.1:/ remote/read only/setuid/devices/rstchown/port=32789/public/vers=2/proto=udp/xattr/dev=4c40004 on Thu Aug 18 09:44:08 2011
/mnt on /devices/pci@0 read/write/nosetuid/nodevices/rstchown/dev=2fc0000 on Thu Aug 18 17:50:13 2011
$

Output "/dev/dsk/c4t0d0p0" is more informative than "/devices/pci@0"
(this is truncated string "/devices/pci@0,0/pci147b,105e@1d,7/storage@5/disk@0,0:q")

$ LC_ALL=C ls -l /dev/dsk/c4t0d0p0
lrwxrwxrwx 1 root root 60 Aug 15 10:58 /dev/dsk/c4t0d0p0 -> ../../devices/pci@0,0/pci147b,105e@1d,7/storage@5/disk@0,0:q
$

This patch is only for "df", "mount", etc. output.

2> In your former system trace, I noticed :

Before trace beginning you can find "# pfiles `pgrep ntfs-3g`" output.
Code:
     pfiles              Report fstat(2) and fcntl(2) information
                         for  all  open files in each process. In
                         addition, a path to the file is reported
                         if  the  information  is  available from
                         /proc/pid/path. This is not  necessarily
                         the same name used to open the file. See
                         proc(4) for more information.

From this output you can see that file handle #2 (2:) corresponds with file:
/devices/pseudo/mm@0:null
Code:
   2: S_IFCHR mode:0666 dev:291,0 ino:6815752 uid:0 gid:3 rdev:13,2
      O_RDWR|O_LARGEFILE
      /devices/pseudo/mm@0:null

This is not the essence. This applies (within Solaris system call) to memory mapping:

# modinfo | grep "memory driver"
158 fffffffff877f000 17a8 13 1 mm (memory driver)
#
$ grep 'mm:' /etc/minor_perm
mm:allkmem 0600 root sys
mm:kmem 0640 root sys
mm:mem 0640 root sys
mm:null 0666 root sys
mm:zero 0666 root sys
$


Thu Aug 18, 2011 20:32
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
You can find attached

man -s2 open

and

man -s2 creat

output for Solaris 10.


Attachments:
open.tgz [7.02 KiB]
Downloaded 1083 times
Thu Aug 18, 2011 20:44
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
As to:

> Output "/dev/dsk/c4t0d0p0" is more informative than "/devices/pci@0"
> (this is truncated string "/devices/pci@0,0/pci147b,105e@1d,7/storage@5/disk@0,0:q")

Device name under Solaris can contains "," see string above.

Your program uses "strsep(&s, ",")" which truncate

fsname=/devices/pci@0,0/pci147b,105e@1d,7/storage@5/disk@0,0:q

for output.

Thus we obtain only:

/devices/pci@0

which is nonsense.


Thu Aug 18, 2011 21:33
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
As to BADVFS

I have made full trace of "cp a.c /mnt/C/b.c".

From this output I see that BADVFS appears during libc:syslog() call (2 times at Aug 19 14:23:45):
Code:
3725/1@1:     -> libc:syslog()
3725/1:      fxstat(2, 6, 0x080461D8)         = 0
3725/1:          d=0x048C0000 i=35798 m=0020000 l=0  u=0     g=0     rdev=0x0054002C
3725/1:         at = Aug 19 14:19:24 MSD 2011  [ 1313749164.000000000 ]
3725/1:         mt = Aug 19 14:19:24 MSD 2011  [ 1313749164.000000000 ]
3725/1:         ct = Aug 19 14:19:24 MSD 2011  [ 1313749164.000000000 ]
3725/1:          bsz=8192  blks=0     fs=BADVFS
3725/1:      time()                  = 1313749500
3725/1:      getpid()               = 3725 [1]
3725/1:      putmsg(6, 0x08046B98, 0x08046BA4, 0)      = 0
3725/1:         ctl:  maxlen=24   len=24   buf=0x08046260: "\0\0\0\0\0\010\0"..
3725/1:         dat:  maxlen=1280 len=112  buf=0x08046278: " A u g   1 9   1"..
3725/1:      open("/var/run/syslog_door", O_RDONLY)      = 7
3725/1:      fstat64(7, 0x08045E20)            = 0
3725/1:          d=0x04B00000 i=54    m=0150644 l=1  u=0     g=0     sz=0
3725/1:         at = Aug 19 12:43:50 MSD 2011  [ 1313743430.137179569 ]
3725/1:         mt = Aug 19 12:43:50 MSD 2011  [ 1313743430.137179569 ]
3725/1:         ct = Aug 19 12:43:50 MSD 2011  [ 1313743430.137200043 ]
3725/1:          bsz=0     blks=0     fs=namefs
3725/1:      door_info(7, 0x08045FF0)         = 0
3725/1:         target=539 proc=0x8057029 data=0x0
3725/1:         attributes=0
3725/1:         uniquifier=639
3725/1:      getpid()               = 3725 [1]
3725/1:      door_call(7, 0x08046028)         = 0
3725/1:         data_ptr=0 data_size=0
3725/1:         desc_ptr=0x0 desc_num=0
3725/1:         rbuf=0x0 rsize=0
3725/1:      close(7)               = 0
3725/1@1:     <- libc:syslog() = 1

----------------------

$ tail /var/adm/messages
Aug 19 14:19:24 kisa ntfs-3g[3725]: [ID 702911 daemon.notice] Mounted /devices/pci@0,0/pci147b,105e@1d,7/storage@5/disk@0,0:q (Read-Write, label "", NTFS 3.1)
Aug 19 14:19:24 kisa ntfs-3g[3725]: [ID 702911 daemon.notice] Cmdline options: uid=1001,gid=1000
Aug 19 14:19:24 kisa ntfs-3g[3725]: [ID 702911 daemon.notice] Mount options: allow_other,nonempty,atime,fsname=/dev/dsk/c4t0d0p0,default_permissions
Aug 19 14:19:24 kisa ntfs-3g[3725]: [ID 702911 daemon.notice] Global ownership and permissions enforced, configuration type 1
Aug 19 14:23:45 kisa ntfs-3g[3725]: [ID 702911 daemon.notice] Index already have such entry: File exists
Aug 19 14:23:45 kisa ntfs-3g[3725]: [ID 702911 daemon.notice] Failed to add entry to the index: File exists
$

See attached full trace listing.


Attachments:
fulltrace-1.tgz [4.72 KiB]
Downloaded 1050 times
Fri Aug 19, 2011 13:03
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Hi,

Quote:
You can find attached
man -s2 open

This thread is difficult to interpret, because you put information which (as far as I can tell) is not related to the subject. I am trying to help you, but not wanting to dig into the full documentation for Solaris.

Please open new threads for new issues. This thread is only for identifying why you cannot write to existing files. I understand there is another issue with commas in device names, i will fix that later, please wait, this may take weeks.

Quote:
From this output I see that BADVFS appears during libc:syslog

Actually there are two stat() calls, the one I am interested in appears as fxstat(), the other is just for opening the log. What I wanted, is the result of stat(1) at command level. Of course this may be different on Solaris, so try to get something similar to :
Code:
$ stat /mnt/C/b.c
  File: `/mnt/C/b.c'
  Size: 1756765      Blocks: 3432       IO Block: 4096   regular file
Device: 803h/2051d   Inode: 41553       Links: 1
Access: (0644/-rw-r--r--)  Uid: (  500/   linux)   Gid: (  500/   linux)
Access: 2011-08-19 10:13:05.850722000 +0200
Modify: 2011-08-19 10:13:01.072527000 +0200
Change: 2011-08-19 10:13:01.072527000 +0200
Birth: -

If nothing similar exists on Solaris, just do
Code:
ls -l /mnt/C/b.c


Regards

Jean-Pierre


Fri Aug 19, 2011 15:59
Profile

Joined: Mon Aug 15, 2011 20:44
Posts: 14
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
1)

In my message (Fri Aug 19, 2011 13:03) you can find attached
full trace "ntfs-3g" when I do "cp a.c /mnt/C/b.c" with all
share library function and all systems call.

Enter in share library (e.g. libc) function (syslog()) marked as:

-> libc:syslog()

return - as:

<- libc:syslog() = 1

2)

As to ",". Patch in my message (Thu Aug 18, 2011 16:39) is appropriate for Solaris, I think. It gives output similar the others filesystem's drivers.

3)

Solaris does not have stat(1) call. I made trace for "ls -l /mnt/C/b.c". See attachment.

Fragment with lstat(), stat() from trace:
Code:
5600/1:      lstat64("/mnt/C/b.c", 0x08046100)      = 0
5600/1:          d=0x02FC0000 i=3     m=0100777 l=1  u=1001  g=1000  sz=707
5600/1:         at = Aug 17 21:33:07 MSD 2011  [ 1313602387.545838000 ]
5600/1:         mt = Aug 17 15:55:27 MSD 2011  [ 1313582127.056920000 ]
5600/1:         ct = Aug 17 15:55:27 MSD 2011  [ 1313582127.056920000 ]
5600/1:          bsz=512   blks=2     fs=fuse
5600/1:      pathconf("/mnt/C/b.c", _PC_ACL_ENABLED)      = 0
5600/1:      acl("/mnt/C/b.c", GETACLCNT, 0, 0x00000000)   = 4
5600/1:      stat64("/mnt/C/b.c", 0x08046020)      = 0
5600/1:          d=0x02FC0000 i=3     m=0100777 l=1  u=1001  g=1000  sz=707
5600/1:         at = Aug 17 21:33:07 MSD 2011  [ 1313602387.545838000 ]
5600/1:         mt = Aug 17 15:55:27 MSD 2011  [ 1313582127.056920000 ]
5600/1:         ct = Aug 17 15:55:27 MSD 2011  [ 1313582127.056920000 ]
5600/1:          bsz=512   blks=2     fs=fuse
5600/1:      acl("/mnt/C/b.c", GETACL, 4, 0x0806F898)   = 4


Attachments:
fulltrace-2.tgz [10.83 KiB]
Downloaded 1107 times
Fri Aug 19, 2011 21:59
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Hi,

Quote:
Fragment with lstat(), stat() from trace:

This is correct. There must be another reason why opening an existing file turns into a create(). You will have to put traces in fuse and vfs.

Did you get the same result with earlier versions ?

Some clue might be given by doing "open(name,O_WRONLY | O_TRUNC);" on an existing file. Mounting with option trace should show OPEN and TRUNCATE.

As a workaround you may insert an unlink() into create() to delete existing files. Try the attached patch (which may have unwanted consequences).

Regards

Jean-Pierre


Attachments:
ntfs-3g.c.patch.gz [268 Bytes]
Downloaded 1050 times
Sun Aug 21, 2011 09:28
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: open(..., O_RDWR | O_CREAT | O_TRUNC, 0666) under Solaris 10
Hi,

See http://b.andre.pagesperso-orange.fr/ope ... fs-3g.html for workarounds.

Regards

Jean-Pierre


Thu Jan 05, 2012 09:31
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.