public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: ufs: fix symlink creation on ufs2
@ 2008-01-02 20:47 Evgeniy Dushistov
  2008-01-10  7:51 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Evgeniy Dushistov @ 2008-01-02 20:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Steven, linux-kernel

If create symlink on UFS2 filesystem under Linux,
it looks wrong under other OSes, because of max symlink length
field was not initialized properly, and data blocks were not
used to save short symlink names.

Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Cc: Steven <stevenaaus@yahoo.com>

---

diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 0072cb3..14605c0 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -131,6 +131,8 @@ static void ufs_print_super_stuff(struct super_block *sb,
 		printk(KERN_INFO"  cs_nffree(Num of free frags): %llu\n",
 		       (unsigned long long)
 		       fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree));
+		printk(KERN_INFO"  fs_maxsymlinklen: %u\n",
+		       usb3->fs_un2.fs_44.fs_maxsymlinklen);
 	} else {
 		printk(" sblkno:      %u\n", fs32_to_cpu(sb, usb1->fs_sblkno));
 		printk(" cblkno:      %u\n", fs32_to_cpu(sb, usb1->fs_cblkno));
@@ -1060,8 +1062,8 @@ magic_found:
 	uspi->s_bpf = uspi->s_fsize << 3;
 	uspi->s_bpfshift = uspi->s_fshift + 3;
 	uspi->s_bpfmask = uspi->s_bpf - 1;
-	if ((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) ==
-	    UFS_MOUNT_UFSTYPE_44BSD)
+	if ((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_44BSD ||
+	    (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_UFS2)
 		uspi->s_maxsymlinklen =
 		    fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen);
 
-- 
/Evgeniy


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH]: ufs: fix symlink creation on ufs2
  2008-01-02 20:47 [PATCH]: ufs: fix symlink creation on ufs2 Evgeniy Dushistov
@ 2008-01-10  7:51 ` Andrew Morton
  2008-01-10  8:40   ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2008-01-10  7:51 UTC (permalink / raw)
  To: Evgeniy Dushistov; +Cc: Steven, linux-kernel

On Wed, 2 Jan 2008 23:47:04 +0300 Evgeniy Dushistov <dushistov@mail.ru> wrote:

> If create symlink on UFS2 filesystem under Linux,
> it looks wrong under other OSes, because of max symlink length
> field was not initialized properly, and data blocks were not
> used to save short symlink names.
> 
> Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
> Cc: Steven <stevenaaus@yahoo.com>
> 
> ---
> 
> diff --git a/fs/ufs/super.c b/fs/ufs/super.c
> index 0072cb3..14605c0 100644
> --- a/fs/ufs/super.c
> +++ b/fs/ufs/super.c
> @@ -131,6 +131,8 @@ static void ufs_print_super_stuff(struct super_block *sb,
>  		printk(KERN_INFO"  cs_nffree(Num of free frags): %llu\n",
>  		       (unsigned long long)
>  		       fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree));
> +		printk(KERN_INFO"  fs_maxsymlinklen: %u\n",
> +		       usb3->fs_un2.fs_44.fs_maxsymlinklen);

I assume this needs conversion via fs32_to_cpu() before we print it.

>  	} else {
>  		printk(" sblkno:      %u\n", fs32_to_cpu(sb, usb1->fs_sblkno));
>  		printk(" cblkno:      %u\n", fs32_to_cpu(sb, usb1->fs_cblkno));
> @@ -1060,8 +1062,8 @@ magic_found:
>  	uspi->s_bpf = uspi->s_fsize << 3;
>  	uspi->s_bpfshift = uspi->s_fshift + 3;
>  	uspi->s_bpfmask = uspi->s_bpf - 1;
> -	if ((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) ==
> -	    UFS_MOUNT_UFSTYPE_44BSD)
> +	if ((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_44BSD ||
> +	    (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_UFS2)
>  		uspi->s_maxsymlinklen =
>  		    fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen);
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: ufs: fix symlink creation on ufs2
  2008-01-10  7:51 ` Andrew Morton
@ 2008-01-10  8:40   ` Christoph Hellwig
  2008-01-10  8:44     ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2008-01-10  8:40 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Evgeniy Dushistov, Steven, linux-kernel

On Wed, Jan 09, 2008 at 11:51:48PM -0800, Andrew Morton wrote:
> > +++ b/fs/ufs/super.c
> > @@ -131,6 +131,8 @@ static void ufs_print_super_stuff(struct super_block *sb,
> >  		printk(KERN_INFO"  cs_nffree(Num of free frags): %llu\n",
> >  		       (unsigned long long)
> >  		       fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree));
> > +		printk(KERN_INFO"  fs_maxsymlinklen: %u\n",
> > +		       usb3->fs_un2.fs_44.fs_maxsymlinklen);
> 
> I assume this needs conversion via fs32_to_cpu() before we print it.

Yes, it does.  I wish people would run sparse before submitting patches :P


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: ufs: fix symlink creation on ufs2
  2008-01-10  8:40   ` Christoph Hellwig
@ 2008-01-10  8:44     ` Al Viro
  0 siblings, 0 replies; 4+ messages in thread
From: Al Viro @ 2008-01-10  8:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Andrew Morton, Evgeniy Dushistov, Steven, linux-kernel

On Thu, Jan 10, 2008 at 08:40:41AM +0000, Christoph Hellwig wrote:
> On Wed, Jan 09, 2008 at 11:51:48PM -0800, Andrew Morton wrote:
> > > +++ b/fs/ufs/super.c
> > > @@ -131,6 +131,8 @@ static void ufs_print_super_stuff(struct super_block *sb,
> > >  		printk(KERN_INFO"  cs_nffree(Num of free frags): %llu\n",
> > >  		       (unsigned long long)
> > >  		       fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree));
> > > +		printk(KERN_INFO"  fs_maxsymlinklen: %u\n",
> > > +		       usb3->fs_un2.fs_44.fs_maxsymlinklen);
> > 
> > I assume this needs conversion via fs32_to_cpu() before we print it.
> 
> Yes, it does.  I wish people would run sparse before submitting patches :P

sparse wouldn't have helped it in the current state.  The thing is, it
doesn't understand printf-style formats.  We probably ought to implement
that - would have a benefit of being able to get rid of gcc stupidity
in that area and actually define conversion specifiers of our own for
things like u64, dma_addr_t, etc. without having gcc scream at us...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-10  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-02 20:47 [PATCH]: ufs: fix symlink creation on ufs2 Evgeniy Dushistov
2008-01-10  7:51 ` Andrew Morton
2008-01-10  8:40   ` Christoph Hellwig
2008-01-10  8:44     ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox