Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / udf / inode.c
index 3d68de3..2983afd 100644 (file)
@@ -4,11 +4,6 @@
  * PURPOSE
  *  Inode handling routines for the OSTA-UDF(tm) filesystem.
  *
- * CONTACTS
- *  E-mail regarding any portion of the Linux UDF file system should be
- *  directed to the development team mailing list (run by majordomo):
- *    linux_udf@hpesjro.fc.hp.com
- *
  * COPYRIGHT
  *  This file is distributed under the terms of the GNU General Public
  *  License (GPL). Copies of the GPL can be obtained from:
@@ -87,6 +82,8 @@ static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
  */
 void udf_delete_inode(struct inode * inode)
 {
+       truncate_inode_pages(&inode->i_data, 0);
+
        if (is_bad_inode(inode))
                goto no_delete;
 
@@ -315,12 +312,10 @@ static int udf_get_block(struct inode *inode, sector_t block, struct buffer_head
        err = 0;
 
        bh = inode_getblk(inode, block, &err, &phys, &new);
-       if (bh)
-               BUG();
+       BUG_ON(bh);
        if (err)
                goto abort;
-       if (!phys)
-               BUG();
+       BUG_ON(!phys);
 
        if (new)
                set_buffer_new(bh_result);
@@ -1048,10 +1043,14 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
        }
 
        inode->i_uid = le32_to_cpu(fe->uid);
-       if ( inode->i_uid == -1 ) inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
+       if (inode->i_uid == -1 || UDF_QUERY_FLAG(inode->i_sb,
+                                       UDF_FLAG_UID_IGNORE))
+               inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
 
        inode->i_gid = le32_to_cpu(fe->gid);
-       if ( inode->i_gid == -1 ) inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
+       if (inode->i_gid == -1 || UDF_QUERY_FLAG(inode->i_sb,
+                                       UDF_FLAG_GID_IGNORE))
+               inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
 
        inode->i_nlink = le16_to_cpu(fe->fileLinkCount);
        if (!inode->i_nlink)
@@ -1338,11 +1337,13 @@ udf_update_inode(struct inode *inode, int do_sync)
                return err;
        }
 
-       if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid)
-               fe->uid = cpu_to_le32(inode->i_uid);
+       if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET))
+               fe->uid = cpu_to_le32(-1);
+       else fe->uid = cpu_to_le32(inode->i_uid);
 
-       if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid)
-               fe->gid = cpu_to_le32(inode->i_gid);
+       if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET))
+               fe->gid = cpu_to_le32(-1);
+       else fe->gid = cpu_to_le32(inode->i_gid);
 
        udfperms =      ((inode->i_mode & S_IRWXO)     ) |
                        ((inode->i_mode & S_IRWXG) << 2) |
@@ -1960,11 +1961,6 @@ int8_t inode_bmap(struct inode *inode, int block, kernel_lb_addr *bloc, uint32_t
                printk(KERN_ERR "udf: inode_bmap: block < 0\n");
                return -1;
        }
-       if (!inode)
-       {
-               printk(KERN_ERR "udf: inode_bmap: NULL inode\n");
-               return -1;
-       }
 
        *extoffset = 0;
        *elen = 0;