Graham Watson
|
Effect of Duplicate inode numbers in resource managed files
|
Graham Watson
01/15/2013 4:35 AM
post98563
|
Effect of Duplicate inode numbers in resource managed files
Hi,
We have a system running on QNX 6.4.1 which makes use of filesystem resource managers. During an investigation it was
discovered that several files in different directories have the same inode number. The inode number is assigned by the
resource manager and is not left with a zero value to have one assigned by the O/S. Can anyone give me any information
they might have that details the possible implications of having files in the same filesystem with non unique inode
numbers. The files themselves are accessed in a variety of ways,
From PHP, from O/S commands such as cat, more etc. and from O/S APIs open() and fopen().
The easy solution as you might point out is to make sure the inode numbers are non-unique, but we have systems in the
field and urgently need to know if there are any known issues.
Thanks for your help
|
|
|
Mario Beaulieu
|
Re: Effect of Duplicate inode numbers in resource managed files
|
Mario Beaulieu
01/15/2013 9:22 AM
post98567
|
Re: Effect of Duplicate inode numbers in resource managed files
The inode is a filesystem data structure that represents a file (its location on disk, owner, permissions, etc).
If 2 "files" on the same partition have the same inode, they are actually 2 names for the same file.
You can create many names for the same file with the command "ln".
When you do "ls -l", the first value after the permissions is the number of files pointing to that inode, or should I
say, the number of filenames corresponding to that file.
Below, I have created file "myfile" and the link number is 1.
After creating a second name for that same file with command "ln", we see that the number of links is 2 for each of
those:
# echo "Hello" > myfile
# ls -l
total 1
-rw-rw-r-- 1 root nto 6 Jan 15 09:07 myfile
# ln myfile AnotherLinkToMyFyle
# ls -l
total 2
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 AnotherLinkToMyFyle
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 myfile
# echo "Hello again" > otherFile
# ls -l
total 3
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 AnotherLinkToMyFyle
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 myfile
-rw-rw-r-- 1 root nto 12 Jan 15 09:12 otherFile
#
See the inode number like the page number in a book. In addition to the inode, you have to check the partition. Inodes
on different partitions are completely unrelated, like page numbers on 2 different books.
|
|
|
Graham Watson
|
RE: Effect of Duplicate inode numbers in resource managed files
|
Graham Watson
01/15/2013 11:12 AM
post98577
|
RE: Effect of Duplicate inode numbers in resource managed files
<BR>
<BR>
HI Mario
Thanks for your reply, I understand was an inode is and have had a lot of experience with UNIX filesystems. My question
in more to do with the implications of having duplicate inodes in systems out in the field and what possible problems
might arise. The systems we run control very heavy and expensive equipment and I would not want anything going wrong and
someone possible getting hurt. If you can give me anymore info on what possible side effects might occour I would be
very grateful.
Regards
Graham Watson | Software Engineer
Waukesha Magnetic Bearings
Downlands Business Park, Lyons Way, Worthing
West Sussex BN14 9LA United Kingdom
Mobile: +44 (0)7762 541863 | Office: +44 (0)1903 275543
gwatson@waukbearing.com
www.waukbearing.com
Please consider the environment before you print.
-----Original Message-----
From: Mario Beaulieu [mailto:community-noreply@qnx.com]
Sent: 15 January 2013 14:22
To: general-filesystems
Subject: Re: Effect of Duplicate inode numbers in resource managed files
The inode is a filesystem data structure that represents a file (its location on disk, owner, permissions, etc).
If 2 "files" on the same partition have the same inode, they are actually 2 names for the same file.
You can create many names for the same file with the command "ln".
When you do "ls -l", the first value after the permissions is the number of files pointing to that inode, or should I
say, the number of filenames corresponding to that file.
Below, I have created file "myfile" and the link number is 1.
After creating a second name for that same file with command "ln", we see that the number of links is 2 for each of
those:
# echo "Hello" > myfile
# ls -l
total 1
-rw-rw-r-- 1 root nto 6 Jan 15 09:07 myfile
# ln myfile AnotherLinkToMyFyle
# ls -l
total 2
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 AnotherLinkToMyFyle
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 myfile
# echo "Hello again" > otherFile
# ls -l
total 3
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 AnotherLinkToMyFyle
-rw-rw-r-- 2 root nto 6 Jan 15 09:07 myfile
-rw-rw-r-- 1 root nto 12 Jan 15 09:12 otherFile
#
See the inode number like the page number in a book. In addition to the inode, you have to check the partition. Inodes
on different partitions are completely unrelated, like page numbers on 2 different books.
_______________________________________________
General
http://community.qnx.com/sf/go/post98567
To cancel your subscription to this discussion, please e-mail general-filesystems-unsubscribe@community.qnx.com
<font size="-1">Waukesha Bearings Limited is a limited company registered in England and Wales.<BR>
Registered number: 4203526. Registered office: 53-55 The Broadway, Joel Street, Northwood, Middlesex, HA6 1NZ <BR>
<font color="#A9A9A9">PLEASE NOTE! This message (and any associated files) is intended only for the use of the
individual or entity to which it is addressed and may contain information that is confidential,
subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that
any dissemination, copying or distribution of this message,
or files associated with this message, is strictly prohibited. If you have received this message in error, please notify
us immediately by replying to the message and deleting it from
your computer. Messages sent to and from us may be monitored.
|
|
|
David Sarrazin
|
RE: Effect of Duplicate inode numbers in resource managed files
|
David Sarrazin
01/15/2013 11:29 AM
post98580
|
RE: Effect of Duplicate inode numbers in resource managed files
Graham,
If you are attempting to execute programs from this resmgr, then you'll need to ensure the inodes are unique, as the
process manager uses the inode to identify open executable files. Similiarily, nfsd and fs-nfs3 rely on the inode
number for caching reasons. It depends on what clients are accessing this resource manager, and what the client is
doing with the inode number.
David
> -----Original Message-----
> From: Watson, Graham [mailto:community-noreply@qnx.com]
> Sent: January-15-13 11:10 AM
> To: general-filesystems@community.qnx.com
> Subject: RE: Effect of Duplicate inode numbers in resource managed files
>
> <BR>
> <BR>
> HI Mario
>
> Thanks for your reply, I understand was an inode is and have had a lot of
> experience with UNIX filesystems. My question in more to do with the
> implications of having duplicate inodes in systems out in the field and what
> possible problems might arise. The systems we run control very heavy and
> expensive equipment and I would not want anything going wrong and
> someone possible getting hurt. If you can give me anymore info on what
> possible side effects might occour I would be very grateful.
>
> Regards
>
> Graham Watson | Software Engineer
> Waukesha Magnetic Bearings
> Downlands Business Park, Lyons Way, Worthing West Sussex BN14 9LA
> United Kingdom
> Mobile: +44 (0)7762 541863 | Office: +44 (0)1903 275543
> gwatson@waukbearing.com www.waukbearing.com P Please consider the
> environment before you print.
>
> -----Original Message-----
> From: Mario Beaulieu [mailto:community-noreply@qnx.com]
> Sent: 15 January 2013 14:22
> To: general-filesystems
> Subject: Re: Effect of Duplicate inode numbers in resource managed files
>
> The inode is a filesystem data structure that represents a file (its location on
> disk, owner, permissions, etc).
> If 2 "files" on the same partition have the same inode, they are actually 2
> names for the same file.
>
> You can create many names for the same file with the command "ln".
> When you do "ls -l", the first value after the permissions is the number of
> files pointing to that inode, or should I say, the number of filenames
> corresponding to that file.
> Below, I have created file "myfile" and the link number is 1.
> After creating a second name for that same file with command "ln", we see
> that the number of links is 2 for each of those:
>
> # echo "Hello" > myfile
> # ls -l
> total 1
> -rw-rw-r-- 1 root nto 6 Jan 15 09:07 myfile
> # ln myfile AnotherLinkToMyFyle
> # ls -l
> total 2
> -rw-rw-r-- 2 root nto 6 Jan 15 09:07 AnotherLinkToMyFyle
> -rw-rw-r-- 2 root nto 6 Jan 15 09:07 myfile
> # echo "Hello again" > otherFile
> # ls -l
> total 3
> -rw-rw-r-- 2 root nto 6 Jan 15 09:07 AnotherLinkToMyFyle
> -rw-rw-r-- 2 root nto 6 Jan 15 09:07 myfile
> -rw-rw-r-- 1 root nto 12 Jan 15 09:12 otherFile
> #
>
> See the inode number like the page number in a book. In addition to the
> inode, you have to check the partition. Inodes on different partitions are
> completely unrelated, like page numbers on 2 different books.
>
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post98567
> To cancel your subscription to this discussion, please e-mail general-
> filesystems-unsubscribe@community.qnx.com
> <font size="-1">Waukesha Bearings Limited is a limited company registered
> in England and Wales.<BR> Registered number: 4203526. Registered office:
> 53-55 The Broadway, Joel Street, Northwood, Middlesex, HA6...
View Full Message
|
|
|
Graham Watson
|
Re: RE: Effect of Duplicate inode numbers in resource managed files
|
Graham Watson
01/16/2013 4:40 AM
post98591
|
Re: RE: Effect of Duplicate inode numbers in resource managed files
Thanks for the reply David, the vast majority of the access to the files is with read() and write() after and open()
call. Am I correct in assuming that when a file is open()ed by name it will always open the correct file regardless of
the inode number ?
|
|
|
|