Merge git://git.infradead.org/mtd-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Wed, 28 Jun 2006 02:13:56 +0000 (19:13 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 28 Jun 2006 02:13:56 +0000 (19:13 -0700)
* git://git.infradead.org/mtd-2.6:
  [MTD] NAND: Select chip before checking write protect status
  [MTD] CORE mtdchar.c: fix off-by-one error in lseek()
  [MTD] NAND: Fix typo in mtd/nand/ts7250.c
  [JFFS2][XATTR] coexistence between xattr and write buffering support.
  [JFFS2][XATTR] Fix wrong copyright
  [JFFS2][XATTR] Re-define xd->refcnt as atomic_t
  [JFFS2][XATTR] Fix memory leak with jffs2_xattr_ref
  [JFFS2][XATTR] rid unnecessary writing of delete marker.
  [JFFS2][XATTR] Fix ACL bug when updating null xattr by null ACL.
  [JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion
  [MTD] Fix off-by-one error in physmap.c
  [MTD] Remove unused 'nr_banks' variable from ixp2000 map driver
  [MTD NAND] s3c2412 support in s3c2410.c
  [MTD] Initialize 'writesize'
  [MTD] NAND: ndfc fix address offset thinko
  [MTD] NAND: S3C2410 convert prinks to dev_*()s
  [MTD] NAND: Missing fixups

1  2 
fs/Kconfig
fs/jffs2/erase.c
fs/jffs2/nodemgmt.c
fs/jffs2/summary.c

diff --combined fs/Kconfig
@@@ -1116,7 -1116,7 +1116,7 @@@ config JFFS2_SUMMAR
  
  config JFFS2_FS_XATTR
        bool "JFFS2 XATTR support (EXPERIMENTAL)"
-       depends on JFFS2_FS && EXPERIMENTAL && !JFFS2_FS_WRITEBUFFER
+       depends on JFFS2_FS && EXPERIMENTAL
        default n
        help
          Extended attributes are name:value pairs associated with inodes by
@@@ -1490,12 -1490,7 +1490,12 @@@ config NFS
        select LOCKD
        select SUNRPC
        select EXPORTFS
 -      select NFS_ACL_SUPPORT if NFSD_V3_ACL || NFSD_V2_ACL
 +      select NFSD_V2_ACL if NFSD_V3_ACL
 +      select NFS_ACL_SUPPORT if NFSD_V2_ACL
 +      select NFSD_TCP if NFSD_V4
 +      select CRYPTO_MD5 if NFSD_V4
 +      select CRYPTO if NFSD_V4
 +      select FS_POSIX_ACL if NFSD_V4
        help
          If you want your Linux box to act as an NFS *server*, so that other
          computers on your local network which support NFS can access certain
@@@ -1533,6 -1528,7 +1533,6 @@@ config NFSD_V
  config NFSD_V3_ACL
        bool "Provide server support for the NFSv3 ACL protocol extension"
        depends on NFSD_V3
 -      select NFSD_V2_ACL
        help
          Implement the NFSv3 ACL protocol extension for manipulating POSIX
          Access Control Lists on exported file systems. NFS clients should
  config NFSD_V4
        bool "Provide NFSv4 server support (EXPERIMENTAL)"
        depends on NFSD_V3 && EXPERIMENTAL
 -      select NFSD_TCP
 -      select CRYPTO_MD5
 -      select CRYPTO
 -      select FS_POSIX_ACL
        help
          If you would like to include the NFSv4 server as well as the NFSv2
          and NFSv3 servers, say Y here.  This feature is experimental, and
@@@ -1722,7 -1722,7 +1722,7 @@@ config CIFS_STAT
          mounted by the cifs client to be displayed in /proc/fs/cifs/Stats
  
  config CIFS_STATS2
 -      bool "CIFS extended statistics"
 +      bool "Extended statistics"
        depends on CIFS_STATS
        help
          Enabling this option will allow more detailed statistics on SMB
          Unless you are a developer or are doing network performance analysis
          or tuning, say N.
  
 +config CIFS_WEAK_PW_HASH
 +      bool "Support legacy servers which use weaker LANMAN security"
 +      depends on CIFS
 +      help
 +        Modern CIFS servers including Samba and most Windows versions
 +        (since 1997) support stronger NTLM (and even NTLMv2 and Kerberos)
 +        security mechanisms. These hash the password more securely
 +        than the mechanisms used in the older LANMAN version of the
 +          SMB protocol needed to establish sessions with old SMB servers.
 +
 +        Enabling this option allows the cifs module to mount to older
 +        LANMAN based servers such as OS/2 and Windows 95, but such
 +        mounts may be less secure than mounts using NTLM or more recent
 +        security mechanisms if you are on a public network.  Unless you
 +        have a need to access old SMB servers (and are on a private 
 +        network) you probably want to say N.  Even if this support
 +        is enabled in the kernel build, they will not be used
 +        automatically. At runtime LANMAN mounts are disabled but
 +        can be set to required (or optional) either in
 +        /proc/fs/cifs (see fs/cifs/README for more detail) or via an
 +        option on the mount command. This support is disabled by 
 +        default in order to reduce the possibility of a downgrade
 +        attack.
 + 
 +        If unsure, say N.
 +
  config CIFS_XATTR
          bool "CIFS extended attributes"
          depends on CIFS
@@@ -1789,16 -1763,6 +1789,16 @@@ config CIFS_POSI
          (such as Samba 3.10 and later) which can negotiate
          CIFS POSIX ACL support.  If unsure, say N.
  
 +config CIFS_DEBUG2
 +      bool "Enable additional CIFS debugging routines"
 +      help
 +         Enabling this option adds a few more debugging routines
 +         to the cifs code which slightly increases the size of
 +         the cifs module and can cause additional logging of debug
 +         messages in some error paths, slowing performance. This
 +         option can be turned off unless you are debugging
 +         cifs problems.  If unsure, say N.
 +         
  config CIFS_EXPERIMENTAL
          bool "CIFS Experimental Features (EXPERIMENTAL)"
          depends on CIFS && EXPERIMENTAL
            If unsure, say N.
  
  config CIFS_UPCALL
 -        bool "CIFS Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)"
 +        bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)"
          depends on CIFS_EXPERIMENTAL
          select CONNECTOR
          help
diff --combined fs/jffs2/erase.c
@@@ -53,7 -53,8 +53,7 @@@ static void jffs2_erase_block(struct jf
        if (!instr) {
                printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");
                spin_lock(&c->erase_completion_lock);
 -              list_del(&jeb->list);
 -              list_add(&jeb->list, &c->erase_pending_list);
 +              list_move(&jeb->list, &c->erase_pending_list);
                c->erasing_size -= c->sector_size;
                c->dirty_size += c->sector_size;
                jeb->dirty_size = c->sector_size;
@@@ -85,7 -86,8 +85,7 @@@
                /* Erase failed immediately. Refile it on the list */
                D1(printk(KERN_DEBUG "Erase at 0x%08x failed: %d. Refiling on erase_pending_list\n", jeb->offset, ret));
                spin_lock(&c->erase_completion_lock);
 -              list_del(&jeb->list);
 -              list_add(&jeb->list, &c->erase_pending_list);
 +              list_move(&jeb->list, &c->erase_pending_list);
                c->erasing_size -= c->sector_size;
                c->dirty_size += c->sector_size;
                jeb->dirty_size = c->sector_size;
@@@ -159,7 -161,8 +159,7 @@@ static void jffs2_erase_succeeded(struc
  {
        D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08x\n", jeb->offset));
        spin_lock(&c->erase_completion_lock);
 -      list_del(&jeb->list);
 -      list_add_tail(&jeb->list, &c->erase_complete_list);
 +      list_move_tail(&jeb->list, &c->erase_complete_list);
        spin_unlock(&c->erase_completion_lock);
        /* Ensure that kupdated calls us again to mark them clean */
        jffs2_erase_pending_trigger(c);
@@@ -175,7 -178,8 +175,7 @@@ static void jffs2_erase_failed(struct j
                if (!jffs2_write_nand_badblock(c, jeb, bad_offset)) {
                        /* We'd like to give this block another try. */
                        spin_lock(&c->erase_completion_lock);
 -                      list_del(&jeb->list);
 -                      list_add(&jeb->list, &c->erase_pending_list);
 +                      list_move(&jeb->list, &c->erase_pending_list);
                        c->erasing_size -= c->sector_size;
                        c->dirty_size += c->sector_size;
                        jeb->dirty_size = c->sector_size;
        spin_lock(&c->erase_completion_lock);
        c->erasing_size -= c->sector_size;
        c->bad_size += c->sector_size;
 -      list_del(&jeb->list);
 -      list_add(&jeb->list, &c->bad_list);
 +      list_move(&jeb->list, &c->bad_list);
        c->nr_erasing_blocks--;
        spin_unlock(&c->erase_completion_lock);
        wake_up(&c->erase_wait);
@@@ -225,7 -230,6 +225,6 @@@ static inline void jffs2_remove_node_re
                           at the end of the linked list. Stash it and continue
                           from the beginning of the list */
                        ic = (struct jffs2_inode_cache *)(*prev);
-                       BUG_ON(ic->class != RAWNODE_CLASS_INODE_CACHE);
                        prev = &ic->nodes;
                        continue;
                }
  
        /* PARANOIA */
        if (!ic) {
-               printk(KERN_WARNING "inode_cache not found in remove_node_refs()!!\n");
+               JFFS2_WARNING("inode_cache/xattr_datum/xattr_ref"
+                             " not found in remove_node_refs()!!\n");
                return;
        }
  
                printk("\n");
        });
  
-       if (ic->nodes == (void *)ic && ic->nlink == 0)
-               jffs2_del_ino_cache(c, ic);
+       switch (ic->class) {
+ #ifdef CONFIG_JFFS2_FS_XATTR
+               case RAWNODE_CLASS_XATTR_DATUM:
+                       jffs2_release_xattr_datum(c, (struct jffs2_xattr_datum *)ic);
+                       break;
+               case RAWNODE_CLASS_XATTR_REF:
+                       jffs2_release_xattr_ref(c, (struct jffs2_xattr_ref *)ic);
+                       break;
+ #endif
+               default:
+                       if (ic->nodes == (void *)ic && ic->nlink == 0)
+                               jffs2_del_ino_cache(c, ic);
+       }
  }
  
  void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
diff --combined fs/jffs2/nodemgmt.c
@@@ -211,7 -211,8 +211,7 @@@ static int jffs2_find_nextblock(struct 
                        struct jffs2_eraseblock *ejeb;
  
                        ejeb = list_entry(c->erasable_list.next, struct jffs2_eraseblock, list);
 -                      list_del(&ejeb->list);
 -                      list_add_tail(&ejeb->list, &c->erase_pending_list);
 +                      list_move_tail(&ejeb->list, &c->erase_pending_list);
                        c->nr_erasing_blocks++;
                        jffs2_erase_pending_trigger(c);
                        D1(printk(KERN_DEBUG "jffs2_find_nextblock: Triggering erase of erasable block at 0x%08x\n",
@@@ -683,19 -684,26 +683,26 @@@ void jffs2_mark_node_obsolete(struct jf
                spin_lock(&c->erase_completion_lock);
  
                ic = jffs2_raw_ref_to_ic(ref);
-               /* It seems we should never call jffs2_mark_node_obsolete() for
-                  XATTR nodes.... yet. Make sure we notice if/when we change
-                  that :) */
-               BUG_ON(ic->class != RAWNODE_CLASS_INODE_CACHE);
                for (p = &ic->nodes; (*p) != ref; p = &((*p)->next_in_ino))
                        ;
  
                *p = ref->next_in_ino;
                ref->next_in_ino = NULL;
  
-               if (ic->nodes == (void *)ic && ic->nlink == 0)
-                       jffs2_del_ino_cache(c, ic);
+               switch (ic->class) {
+ #ifdef CONFIG_JFFS2_FS_XATTR
+                       case RAWNODE_CLASS_XATTR_DATUM:
+                               jffs2_release_xattr_datum(c, (struct jffs2_xattr_datum *)ic);
+                               break;
+                       case RAWNODE_CLASS_XATTR_REF:
+                               jffs2_release_xattr_ref(c, (struct jffs2_xattr_ref *)ic);
+                               break;
+ #endif
+                       default:
+                               if (ic->nodes == (void *)ic && ic->nlink == 0)
+                                       jffs2_del_ino_cache(c, ic);
+                               break;
+               }
                spin_unlock(&c->erase_completion_lock);
        }
  
diff --combined fs/jffs2/summary.c
@@@ -5,7 -5,7 +5,7 @@@
   *                     Zoltan Sogor <weth@inf.u-szeged.hu>,
   *                     Patrik Kluba <pajko@halom.u-szeged.hu>,
   *                     University of Szeged, Hungary
-  *               2005  KaiGai Kohei <kaigai@ak.jp.nec.com>
+  *               2006  KaiGai Kohei <kaigai@ak.jp.nec.com>
   *
   * For licensing information, see the file 'LICENCE' in this directory.
   *
@@@ -43,7 -43,7 +43,7 @@@ int jffs2_sum_init(struct jffs2_sb_inf
                return -ENOMEM;
        }
  
 -      dbg_summary("returned succesfully\n");
 +      dbg_summary("returned successfully\n");
  
        return 0;
  }
@@@ -310,8 -310,6 +310,6 @@@ int jffs2_sum_add_kvec(struct jffs2_sb_
  #ifdef CONFIG_JFFS2_FS_XATTR
                case JFFS2_NODETYPE_XATTR: {
                        struct jffs2_sum_xattr_mem *temp;
-                       if (je32_to_cpu(node->x.version) == 0xffffffff)
-                               return 0;
                        temp = kmalloc(sizeof(struct jffs2_sum_xattr_mem), GFP_KERNEL);
                        if (!temp)
                                goto no_mem;
                }
                case JFFS2_NODETYPE_XREF: {
                        struct jffs2_sum_xref_mem *temp;
-                       if (je32_to_cpu(node->r.ino) == 0xffffffff
-                           && je32_to_cpu(node->r.xid) == 0xffffffff)
-                               return 0;
                        temp = kmalloc(sizeof(struct jffs2_sum_xref_mem), GFP_KERNEL);
                        if (!temp)
                                goto no_mem;
@@@ -483,22 -477,20 +477,20 @@@ static int jffs2_sum_process_sum_data(s
  
                                xd = jffs2_setup_xattr_datum(c, je32_to_cpu(spx->xid),
                                                                je32_to_cpu(spx->version));
-                               if (IS_ERR(xd)) {
-                                       if (PTR_ERR(xd) == -EEXIST) {
-                                               /* a newer version of xd exists */
-                                               if ((err = jffs2_scan_dirty_space(c, jeb, je32_to_cpu(spx->totlen))))
-                                                       return err;
-                                               sp += JFFS2_SUMMARY_XATTR_SIZE;
-                                               break;
-                                       }
-                                       JFFS2_NOTICE("allocation of xattr_datum failed\n");
+                               if (IS_ERR(xd))
                                        return PTR_ERR(xd);
+                               if (xd->version > je32_to_cpu(spx->version)) {
+                                       /* node is not the newest one */
+                                       struct jffs2_raw_node_ref *raw
+                                               = sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
+                                                                   PAD(je32_to_cpu(spx->totlen)), NULL);
+                                       raw->next_in_ino = xd->node->next_in_ino;
+                                       xd->node->next_in_ino = raw;
+                               } else {
+                                       xd->version = je32_to_cpu(spx->version);
+                                       sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
+                                                         PAD(je32_to_cpu(spx->totlen)), (void *)xd);
                                }
-                               xd->node = sum_link_node_ref(c, jeb, je32_to_cpu(spx->offset) | REF_UNCHECKED,
-                                                            PAD(je32_to_cpu(spx->totlen)), NULL);
-                               /* FIXME */ xd->node->next_in_ino = (void *)xd;
                                *pseudo_random += je32_to_cpu(spx->xid);
                                sp += JFFS2_SUMMARY_XATTR_SIZE;
  
                                        JFFS2_NOTICE("allocation of xattr_datum failed\n");
                                        return -ENOMEM;
                                }
-                               ref->ino = 0xfffffffe;
-                               ref->xid = 0xfffffffd;
                                ref->next = c->xref_temp;
                                c->xref_temp = ref;
  
-                               ref->node = sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED,
-                                                             PAD(sizeof(struct jffs2_raw_xref)), NULL);
-                               /* FIXME */ ref->node->next_in_ino = (void *)ref;
+                               sum_link_node_ref(c, jeb, je32_to_cpu(spr->offset) | REF_UNCHECKED,
+                                                 PAD(sizeof(struct jffs2_raw_xref)), (void *)ref);
  
                                *pseudo_random += ref->node->flash_offset;
                                sp += JFFS2_SUMMARY_XREF_SIZE;