linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "Phillip Susi" <psusi@cfl.rr.com>
Cc: "linux kernel" <linux-kernel@vger.kernel.org>,
	bfennema@ix.netcom.com, "Pekka Enberg" <penberg@cs.helsinki.fi>
Subject: Re: [PATCH] udf: fix uid/gid options and add uid/gid=ignore and forget options
Date: Sun, 5 Mar 2006 21:22:20 +0200	[thread overview]
Message-ID: <84144f020603051122k33872fa7p1e7baebcc2b67cda@mail.gmail.com> (raw)
In-Reply-To: <4409EB37.5050308@cfl.rr.com>

[-- Attachment #1: Type: text/plain, Size: 3793 bytes --]

On 3/4/06, Phillip Susi <psusi@cfl.rr.com> wrote:
> This patch fixes a bug in udf where it would write uid/gid = 0 to the
> disk for files owned by the id given with the uid=/gid= mount options.

I don't think it does. You can still get zero uid/gid written on disk
if you specify uid/gid mount options when not specifying uid=forget. I
am not against new features but lets fix the bug first, okay? Adding
new mount options to work around buggy code is not the right solution.

The unconditional memset() is clearly a regression caused by Ben
Fennema's commit "[PATCH] UDF sync with CVS" in the old-2.6-bkcvs.git
repository and should be fixed. Care to try out the included untested
patch to see if it fixes the problem? (Sorry for the attachment, I am
replying via web mail.)

                                   Pekka

[PATCH] udf: fix uid/gid changing to zero

This patch fixes uid/gid changing to zero when uid/gid mount option is
used for UDF. The problem appears when the overriding uid/gid matches
inode. The fix is simple, instead of unconditionally zeroing buffer,
we now only do it for new inodes.

The regression appeared in commit "[PATCH] UDF sync with CVS" and was
first reported by Phillip Susi.

Cc: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 fs/udf/ialloc.c          |    1 +
 fs/udf/inode.c           |    9 +++++++--
 fs/udf/udf_i.h           |    1 +
 include/linux/udf_fs_i.h |    3 ++-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index c9b707b..4bc3dc9 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -146,6 +146,7 @@ struct inode * udf_new_inode (struct ino
 		UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
 	inode->i_mtime = inode->i_atime = inode->i_ctime =
 		UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
+	UDF_I_NEW_INODE(inode) = 1;
 	insert_inode_hash(inode);
 	mark_inode_dirty(inode);
 	up(&sbi->s_alloc_sem);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 395e582..6937da2 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1003,6 +1003,8 @@ static void udf_fill_inode(struct inode
 	long convtime_usec;
 	int offset;

+	UDF_I_NEW_INODE(inode) = 0;
+
 	fe = (struct fileEntry *)bh->b_data;
 	efe = (struct extendedFileEntry *)bh->b_data;

@@ -1307,11 +1309,14 @@ udf_update_inode(struct inode *inode, in
 		return -EIO;
 	}

-	memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
-
 	fe = (struct fileEntry *)bh->b_data;
 	efe = (struct extendedFileEntry *)bh->b_data;

+	if (UDF_I_NEW_INODE(inode) == 1) {
+		memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
+		UDF_I_NEW_INODE(inode) = 0;
+	}
+
 	if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE)
 	{
 		struct unallocSpaceEntry *use =
diff --git a/fs/udf/udf_i.h b/fs/udf/udf_i.h
index d7dbe6f..87f82f7 100644
--- a/fs/udf/udf_i.h
+++ b/fs/udf/udf_i.h
@@ -16,6 +16,7 @@ static inline struct udf_inode_info *UDF
 #define UDF_I_EFE(X)		( UDF_I(X)->i_efe )
 #define UDF_I_USE(X)		( UDF_I(X)->i_use )
 #define UDF_I_STRAT4096(X)	( UDF_I(X)->i_strat4096 )
+#define UDF_I_NEW_INODE(X)	( UDF_I(X)->i_new_inode )
 #define UDF_I_NEXT_ALLOC_BLOCK(X)	( UDF_I(X)->i_next_alloc_block )
 #define UDF_I_NEXT_ALLOC_GOAL(X)	( UDF_I(X)->i_next_alloc_goal )
 #define UDF_I_CRTIME(X)		( UDF_I(X)->i_crtime )
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 1e75084..c21415a 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -51,7 +51,8 @@ struct udf_inode_info
 	unsigned		i_efe : 1;
 	unsigned		i_use : 1;
 	unsigned		i_strat4096 : 1;
-	unsigned		reserved : 26;
+	unsigned		i_new_inode : 1;
+	unsigned		reserved : 25;
 	union
 	{
 		short_ad	*i_sad;

[-- Attachment #2: udf-fix --]
[-- Type: application/octet-stream, Size: 2873 bytes --]

[PATCH] udf: fix uid/gid changing to zero

This patch fixes uid/gid changing to zero when uid/gid mount option is
used for UDF. The problem appears when the overriding uid/gid matches
inode. The fix is simple, instead of unconditionally zeroing buffer,
we now only do it for new inodes.

The regression appeared in commit "[PATCH] UDF sync with CVS" and was
first reported by Phillip Susi.

Cc: Phillip Susi <psusi@cfl.rr.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 fs/udf/ialloc.c          |    1 +
 fs/udf/inode.c           |    9 +++++++--
 fs/udf/udf_i.h           |    1 +
 include/linux/udf_fs_i.h |    3 ++-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index c9b707b..4bc3dc9 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -146,6 +146,7 @@ struct inode * udf_new_inode (struct ino
 		UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
 	inode->i_mtime = inode->i_atime = inode->i_ctime =
 		UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
+	UDF_I_NEW_INODE(inode) = 1;
 	insert_inode_hash(inode);
 	mark_inode_dirty(inode);
 	up(&sbi->s_alloc_sem);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 395e582..6937da2 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1003,6 +1003,8 @@ static void udf_fill_inode(struct inode 
 	long convtime_usec;
 	int offset;
 
+	UDF_I_NEW_INODE(inode) = 0;
+
 	fe = (struct fileEntry *)bh->b_data;
 	efe = (struct extendedFileEntry *)bh->b_data;
 
@@ -1307,11 +1309,14 @@ udf_update_inode(struct inode *inode, in
 		return -EIO;
 	}
 
-	memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
-
 	fe = (struct fileEntry *)bh->b_data;
 	efe = (struct extendedFileEntry *)bh->b_data;
 
+	if (UDF_I_NEW_INODE(inode) == 1) {
+		memset(bh->b_data, 0x00, inode->i_sb->s_blocksize);
+		UDF_I_NEW_INODE(inode) = 0;
+	}
+
 	if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE)
 	{
 		struct unallocSpaceEntry *use =
diff --git a/fs/udf/udf_i.h b/fs/udf/udf_i.h
index d7dbe6f..87f82f7 100644
--- a/fs/udf/udf_i.h
+++ b/fs/udf/udf_i.h
@@ -16,6 +16,7 @@ static inline struct udf_inode_info *UDF
 #define UDF_I_EFE(X)		( UDF_I(X)->i_efe )
 #define UDF_I_USE(X)		( UDF_I(X)->i_use )
 #define UDF_I_STRAT4096(X)	( UDF_I(X)->i_strat4096 )
+#define UDF_I_NEW_INODE(X)	( UDF_I(X)->i_new_inode )
 #define UDF_I_NEXT_ALLOC_BLOCK(X)	( UDF_I(X)->i_next_alloc_block )
 #define UDF_I_NEXT_ALLOC_GOAL(X)	( UDF_I(X)->i_next_alloc_goal )
 #define UDF_I_CRTIME(X)		( UDF_I(X)->i_crtime )
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
index 1e75084..c21415a 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/linux/udf_fs_i.h
@@ -51,7 +51,8 @@ struct udf_inode_info
 	unsigned		i_efe : 1;
 	unsigned		i_use : 1;
 	unsigned		i_strat4096 : 1;
-	unsigned		reserved : 26;
+	unsigned		i_new_inode : 1;
+	unsigned		reserved : 25;
 	union
 	{
 		short_ad	*i_sad;

  reply	other threads:[~2006-03-05 19:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-04 19:32 [PATCH] udf: fix uid/gid options and add uid/gid=ignore and forget options Phillip Susi
2006-03-05 19:22 ` Pekka Enberg [this message]
2006-03-06  1:10   ` Phillip Susi
2006-03-06  7:31     ` Pekka J Enberg
2006-03-07  3:23       ` Phillip Susi
2006-03-07  7:24         ` Pekka J Enberg
2006-03-07 15:49           ` Phillip Susi
2006-03-07 16:50             ` Sergey Vlasov
2006-03-20  2:32 Phillip Susi
2006-03-20  4:04 ` Andrew Morton
2006-03-20 16:25   ` Phillip Susi

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=84144f020603051122k33872fa7p1e7baebcc2b67cda@mail.gmail.com \
    --to=penberg@cs.helsinki.fi \
    --cc=bfennema@ix.netcom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=psusi@cfl.rr.com \
    /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;
as well as URLs for NNTP newsgroup(s).