1. 15 7月, 2008 14 次提交
    • L
      configfs: Fix failing mkdir() making racing rmdir() fail · 6d8344ba
      Louis Rilling 提交于
      When fixing the rename() vs rmdir() deadlock, we stopped locking default groups'
      inodes in configfs_detach_prep(), letting racing mkdir() in default groups
      proceed concurrently. This enables races like below happen, which leads to a
      failing mkdir() making rmdir() fail, despite the group to remove having no
      user-created directory under it in the end.
      
      	process A: 			process B:
      	/* PWD=A/B */
      	mkdir("C")
      	  make_item("C")
      	  attach_group("C")
      					rmdir("A")
      					  detach_prep("A")
      					    detach_prep("B")
      					      error because of "C"
      					  return -ENOTEMPTY
      	    attach_group("C/D")
      	      error (eg -ENOMEM)
      	  return -ENOMEM
      
      This patch prevents such scenarii by making rmdir() wait as long as
      detach_prep() fails because a racing mkdir() is in the middle of attach_group().
      To achieve this, mkdir() sets a flag CONFIGFS_USET_IN_MKDIR in parent's
      configfs_dirent before calling attach_group(), and clears the flag once
      attach_group() is done. detach_prep() fails with -EAGAIN whenever the flag is
      hit and returns the guilty inode's mutex so that rmdir() can wait on it.
      Signed-off-by: NLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      6d8344ba
    • L
      configfs: Fix deadlock with racing rmdir() and rename() · b3e76af8
      Louis Rilling 提交于
      This patch fixes the deadlock between racing sys_rename() and configfs_rmdir().
      
      The idea is to avoid locking i_mutexes of default groups in
      configfs_detach_prep(), and rely instead on the new configfs_dirent_lock to
      protect against configfs_dirent's linkage mutations. To ensure that an mkdir()
      racing with rmdir() will not create new items in a to-be-removed default group,
      we make configfs_new_dirent() check for the CONFIGFS_USET_DROPPING flag right
      before linking the new dirent, and return error if the flag is set. This makes
      racing mkdir()/symlink()/dir_open() fail in places where errors could already
      happen, resp. in (attach_item()|attach_group())/create_link()/new_dirent().
      
      configfs_depend() remains safe since it locks all the path from configfs root,
      and is thus mutually exclusive with rmdir().
      
      An advantage of this is that now detach_groups() unconditionnaly takes the
      default groups i_mutex, which makes it more consistent with populate_groups().
      Signed-off-by: NLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      b3e76af8
    • L
      configfs: Make configfs_new_dirent() return error code instead of NULL · 107ed40b
      Louis Rilling 提交于
      This patch makes configfs_new_dirent return negative error code instead of NULL,
      which will be useful in the next patch to differentiate ENOMEM from ENOENT.
      Signed-off-by: NLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      107ed40b
    • L
      configfs: Protect configfs_dirent s_links list mutations · 5301a77d
      Louis Rilling 提交于
      Symlinks to a config_item are listed under its configfs_dirent s_links, but the
      list mutations are not protected by any common lock.
      
      This patch uses the configfs_dirent_lock spinlock to add the necessary
      protection.
      
      Note: we should also protect the list_empty() test in configfs_detach_prep() but
      1/ the lock should not be released immediately because nothing would prevent the
      list from being filled after a successful list_empty() test, making the problem
      tricky,
      2/ this will be solved by the rmdir() vs rename() deadlock bugfix.
      Signed-off-by: NLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      5301a77d
    • L
      configfs: Introduce configfs_dirent_lock · 6f610764
      Louis Rilling 提交于
      This patch introduces configfs_dirent_lock spinlock to protect configfs_dirent
      traversals against linkage mutations (add/del/move). This will allow
      configfs_detach_prep() to avoid locking i_mutexes.
      
      Locking rules for configfs_dirent linkage mutations are the same plus the
      requirement of taking configfs_dirent_lock. For configfs_dirent walking, one can
      either take appropriate i_mutex as before, or take configfs_dirent_lock.
      
      The spinlock could actually be a mutex, but the critical sections are either
      O(1) or should not be too long (default groups walking in last patch).
      
      ChangeLog:
        - Clarify the comment on configfs_dirent_lock usage
        - Move sd->s_element init before linking the new dirent
        - In lseek(), do not release configfs_dirent_lock before the dirent is
          relinked.
      Signed-off-by: NLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      6f610764
    • J
      ocfs2: Don't snprintf() without a format. · fe9f3877
      Joel Becker 提交于
      Some system files are per-slot.  Their names include the slot number.
      ocfs2_sprintf_system_inode_name() uses the system inode definitions to
      fill in the slot number with snprintf().
      
      For global system files, there is no node number, and the name was
      printed as a format with no arguments.  -Wformat-nonliteral and
      -Wformat-security don't like this.  Instead, use a static "%s" format
      and the name as the argument.
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      fe9f3877
    • J
      ocfs2: Fix CONFIG_OCFS2_DEBUG_FS #ifdefs · e407e397
      Joel Becker 提交于
      A couple places use OCFS2_DEBUG_FS where they really mean
      CONFIG_OCFS2_DEBUG_FS.
      Reported-by: NRobert P. J. Day <rpjday@crashcourse.ca>
      Signed-off-by: NJoel Becker <joel.becker@oracle.com>
      e407e397
    • S
      ocfs2/net: Silence build warnings on sparc64 · 461c6a30
      Sunil Mushran 提交于
      suseconds_t is type long on most arches except sparc64 where it is type int.
      This patch silences the following warnings that are generated when building
      on it.
      
      netdebug.c: In function 'nst_seq_show':
      netdebug.c:152: warning: format '%lu' expects type 'long unsigned int', but argument 13 has type 'suseconds_t'
      netdebug.c:152: warning: format '%lu' expects type 'long unsigned int', but argument 15 has type 'suseconds_t'
      netdebug.c:152: warning: format '%lu' expects type 'long unsigned int', but argument 17 has type 'suseconds_t'
      netdebug.c: In function 'sc_seq_show':
      netdebug.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 19 has type 'suseconds_t'
      netdebug.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 21 has type 'suseconds_t'
      netdebug.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 23 has type 'suseconds_t'
      netdebug.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 25 has type 'suseconds_t'
      netdebug.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 27 has type 'suseconds_t'
      netdebug.c:332: warning: format '%lu' expects type 'long unsigned int', but argument 29 has type 'suseconds_t'
      Signed-off-by: NSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      461c6a30
    • W
      ocfs2: Handle error during journal load · 01af4820
      Wengang Wang 提交于
      This patch ensures the mount fails if the fs is unable to load the journal.
      Signed-off-by: NWengang Wang <wen.gang.wang@oracle.com>
      Acked-by: NSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      01af4820
    • S
      ocfs2: Silence an error message in ocfs2_file_aio_read() · 56753bd3
      Sunil Mushran 提交于
      This patch silences an EINVAL error message in ocfs2_file_aio_read()
      that is always due to a user error.
      Signed-off-by: NSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      56753bd3
    • A
      7600c72b
    • R
      ocfs2: fix printk format warnings with OCFS2_FS_STATS=n · dd25e55e
      Randy Dunlap 提交于
      Fix printk format warnings when OCFS2_FS_STATS=n:
      
      linux-next-20080528/fs/ocfs2/dlmglue.c: In function 'ocfs2_dlm_seq_show':
      linux-next-20080528/fs/ocfs2/dlmglue.c:2623: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'int'
      linux-next-20080528/fs/ocfs2/dlmglue.c:2623: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'int'
      linux-next-20080528/fs/ocfs2/dlmglue.c:2623: warning: format '%llu' expects type 'long long unsigned int', but argument 7 has type 'int'
      linux-next-20080528/fs/ocfs2/dlmglue.c:2623: warning: format '%llu' expects type 'long long unsigned int', but argument 8 has type 'int'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      dd25e55e
    • S
      [PATCH 2/2] ocfs2: Instrument fs cluster locks · 8ddb7b00
      Sunil Mushran 提交于
      This patch adds code to track the number of times the fs takes
      various cluster locks as well as the times associated with it.
      The information is made available to users via debugfs.
      
      This patch was originally written by Jan Kara <jack@suse.cz>.
      Signed-off-by: NSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      8ddb7b00
    • S
      [PATCH 1/2] ocfs2: Add CONFIG_OCFS2_FS_STATS config option · ce7231e9
      Sunil Mushran 提交于
      This patch adds config option CONFIG_OCFS2_FS_STATS to allow building
      the fs with instrumentation enabled. An upcoming patch will provide
      support to instrument cluster locking, which is a crucial overhead in
      a cluster file system. This config option allows users to avoid the cpu
      and memory overhead that is involved in gathering such statistics.
      Signed-off-by: NSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: NMark Fasheh <mfasheh@suse.com>
      ce7231e9
  2. 14 7月, 2008 5 次提交
  3. 13 7月, 2008 14 次提交
  4. 12 7月, 2008 7 次提交