1. 14 Jul, 2008 14 commits
    • Louis Rilling's avatar
      configfs: Fix failing mkdir() making racing rmdir() fail · 6d8344ba
      Louis Rilling authored
      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: default avatarLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      6d8344ba
    • Louis Rilling's avatar
      configfs: Fix deadlock with racing rmdir() and rename() · b3e76af8
      Louis Rilling authored
      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: default avatarLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      b3e76af8
    • Louis Rilling's avatar
      configfs: Make configfs_new_dirent() return error code instead of NULL · 107ed40b
      Louis Rilling authored
      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: default avatarLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      107ed40b
    • Louis Rilling's avatar
      configfs: Protect configfs_dirent s_links list mutations · 5301a77d
      Louis Rilling authored
      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: default avatarLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      5301a77d
    • Louis Rilling's avatar
      configfs: Introduce configfs_dirent_lock · 6f610764
      Louis Rilling authored
      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: default avatarLouis Rilling <Louis.Rilling@kerlabs.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      6f610764
    • Joel Becker's avatar
      ocfs2: Don't snprintf() without a format. · fe9f3877
      Joel Becker authored
      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: default avatarJoel Becker <joel.becker@oracle.com>
      fe9f3877
    • Joel Becker's avatar
      ocfs2: Fix CONFIG_OCFS2_DEBUG_FS #ifdefs · e407e397
      Joel Becker authored
      A couple places use OCFS2_DEBUG_FS where they really mean
      CONFIG_OCFS2_DEBUG_FS.
      Reported-by: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      e407e397
    • Sunil Mushran's avatar
      ocfs2/net: Silence build warnings on sparc64 · 461c6a30
      Sunil Mushran authored
      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: default avatarSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      461c6a30
    • Wengang Wang's avatar
      ocfs2: Handle error during journal load · 01af4820
      Wengang Wang authored
      This patch ensures the mount fails if the fs is unable to load the journal.
      Signed-off-by: default avatarWengang Wang <wen.gang.wang@oracle.com>
      Acked-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      01af4820
    • Sunil Mushran's avatar
      ocfs2: Silence an error message in ocfs2_file_aio_read() · 56753bd3
      Sunil Mushran authored
      This patch silences an EINVAL error message in ocfs2_file_aio_read()
      that is always due to a user error.
      Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      56753bd3
    • Akinobu Mita's avatar
    • Randy Dunlap's avatar
      ocfs2: fix printk format warnings with OCFS2_FS_STATS=n · dd25e55e
      Randy Dunlap authored
      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: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      dd25e55e
    • Sunil Mushran's avatar
      [PATCH 2/2] ocfs2: Instrument fs cluster locks · 8ddb7b00
      Sunil Mushran authored
      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: default avatarSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      8ddb7b00
    • Sunil Mushran's avatar
      [PATCH 1/2] ocfs2: Add CONFIG_OCFS2_FS_STATS config option · ce7231e9
      Sunil Mushran authored
      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: default avatarSunil Mushran <sunil.mushran@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      ce7231e9
  2. 13 Jul, 2008 6 commits
  3. 12 Jul, 2008 17 commits
  4. 11 Jul, 2008 3 commits