[PATCH 32/37] Re: [2.6-BK-URL] NTFS: 2.1.21 - Big update with race/bugfixes

From: Anton Altaparmakov
Date: Tue Oct 19 2004 - 05:53:54 EST


This is patch 32/37 in the series. It contains the following ChangeSet:

<aia21@xxxxxxxxxx> (04/10/15 1.2052)
NTFS: Simplify setup of i_mode in fs/ntfs/inode.c::ntfs_read_locked_inode().

Signed-off-by: Anton Altaparmakov <aia21@xxxxxxxxxx>

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/

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

diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog 2004-10-19 10:15:02 +01:00
+++ b/fs/ntfs/ChangeLog 2004-10-19 10:15:02 +01:00
@@ -132,6 +132,7 @@
inode.h and make fs/ntfs/inode.c::__ntfs_init_inode() non-static and
add a declaration for it to inode.h. Fix some compilation issues
that resulted due to #includes and header file interdependencies.
+ - Simplify setup of i_mode in fs/ntfs/inode.c::ntfs_read_locked_inode().

2.1.20 - Fix two stupid bugs introduced in 2.1.18 release.

diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c
--- a/fs/ntfs/inode.c 2004-10-19 10:15:02 +01:00
+++ b/fs/ntfs/inode.c 2004-10-19 10:15:02 +01:00
@@ -594,14 +594,26 @@
* Also if not a directory, it could be something else, rather than
* a regular file. But again, will do for now.
*/
+ /* Everyone gets all permissions. */
+ vi->i_mode |= S_IRWXUGO;
+ /* If read-only, noone gets write permissions. */
+ if (IS_RDONLY(vi))
+ vi->i_mode &= ~S_IWUGO;
if (m->flags & MFT_RECORD_IS_DIRECTORY) {
vi->i_mode |= S_IFDIR;
+ /*
+ * Apply the directory permissions mask set in the mount
+ * options.
+ */
+ vi->i_mode &= ~vol->dmask;
/* Things break without this kludge! */
if (vi->i_nlink > 1)
vi->i_nlink = 1;
- } else
+ } else {
vi->i_mode |= S_IFREG;
-
+ /* Apply the file permissions mask set in the mount options. */
+ vi->i_mode &= ~vol->fmask;
+ }
/*
* Find the standard information attribute in the mft record. At this
* stage we haven't setup the attribute list stuff yet, so this could
@@ -944,16 +956,6 @@
goto unm_err_out;
}
skip_large_dir_stuff:
- /* Everyone gets read and scan permissions. */
- vi->i_mode |= S_IRUGO | S_IXUGO;
- /* If not read-only, set write permissions. */
- if (!IS_RDONLY(vi))
- vi->i_mode |= S_IWUGO;
- /*
- * Apply the directory permissions mask set in the mount
- * options.
- */
- vi->i_mode &= ~vol->dmask;
/* Setup the operations for this inode. */
vi->i_op = &ntfs_dir_inode_ops;
vi->i_fop = &ntfs_dir_ops;
@@ -1090,13 +1092,6 @@
unmap_mft_record(ni);
m = NULL;
ctx = NULL;
- /* Everyone gets all permissions. */
- vi->i_mode |= S_IRWXUGO;
- /* If read-only, noone gets write permissions. */
- if (IS_RDONLY(vi))
- vi->i_mode &= ~S_IWUGO;
- /* Apply the file permissions mask set in the mount options. */
- vi->i_mode &= ~vol->fmask;
/* Setup the operations for this inode. */
vi->i_op = &ntfs_file_inode_ops;
vi->i_fop = &ntfs_file_ops;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/