1. 17 4月, 2015 9 次提交
  2. 16 4月, 2015 1 次提交
  3. 12 4月, 2015 4 次提交
  4. 26 3月, 2015 2 次提交
    • C
      fs: move struct kiocb to fs.h · e2e40f2c
      Christoph Hellwig 提交于
      struct kiocb now is a generic I/O container, so move it to fs.h.
      Also do a #include diet for aio.h while we're at it.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e2e40f2c
    • S
      hfsplus: fix B-tree corruption after insertion at position 0 · 98cf21c6
      Sergei Antonov 提交于
      Fix B-tree corruption when a new record is inserted at position 0 in the
      node in hfs_brec_insert().  In this case a hfs_brec_update_parent() is
      called to update the parent index node (if exists) and it is passed
      hfs_find_data with a search_key containing a newly inserted key instead
      of the key to be updated.  This results in an inconsistent index node.
      The bug reproduces on my machine after an extents overflow record for
      the catalog file (CNID=4) is inserted into the extents overflow B-tree.
      Because of a low (reserved) value of CNID=4, it has to become the first
      record in the first leaf node.
      
      The resulting first leaf node is correct:
      
        ----------------------------------------------------
        | key0.CNID=4 | key1.CNID=123 | key2.CNID=456, ... |
        ----------------------------------------------------
      
      But the parent index key0 still contains the previous key CNID=123:
      
        -----------------------
        | key0.CNID=123 | ... |
        -----------------------
      
      A change in hfs_brec_insert() makes hfs_brec_update_parent() work
      correctly by preventing it from getting fd->record=-1 value from
      __hfs_brec_find().
      
      Along the way, I removed duplicate code with unification of the if
      condition.  The resulting code is equivalent to the original code
      because node is never 0.
      
      Also hfs_brec_update_parent() will now return an error after getting a
      negative fd->record value.  However, the return value of
      hfs_brec_update_parent() is not checked anywhere in the file and I'm
      leaving it unchanged by this patch.  brec.c lacks error checking after
      some other calls too, but this issue is of less importance than the one
      being fixed by this patch.
      Signed-off-by: NSergei Antonov <saproj@gmail.com>
      Cc: Joe Perches <joe@perches.com>
      Reviewed-by: NVyacheslav Dubeyko <slava@dubeyko.com>
      Acked-by: NHin-Tak Leung <htl10@users.sourceforge.net>
      Cc: Anton Altaparmakov <aia21@cam.ac.uk>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      98cf21c6
  5. 23 2月, 2015 1 次提交
    • D
      VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) · e36cb0b8
      David Howells 提交于
      Convert the following where appropriate:
      
       (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
      
       (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
      
       (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry).  This is actually more
           complicated than it appears as some calls should be converted to
           d_can_lookup() instead.  The difference is whether the directory in
           question is a real dir with a ->lookup op or whether it's a fake dir with
           a ->d_automount op.
      
      In some circumstances, we can subsume checks for dentry->d_inode not being
      NULL into this, provided we the code isn't in a filesystem that expects
      d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
      use d_inode() rather than d_backing_inode() to get the inode pointer).
      
      Note that the dentry type field may be set to something other than
      DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
      manages the fall-through from a negative dentry to a lower layer.  In such a
      case, the dentry type of the negative union dentry is set to the same as the
      type of the lower dentry.
      
      However, if you know d_inode is not NULL at the call site, then you can use
      the d_is_xxx() functions even in a filesystem.
      
      There is one further complication: a 0,0 chardev dentry may be labelled
      DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE.  Strictly, this was
      intended for special directory entry types that don't have attached inodes.
      
      The following perl+coccinelle script was used:
      
      use strict;
      
      my @callers;
      open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
          die "Can't grep for S_ISDIR and co. callers";
      @callers = <$fd>;
      close($fd);
      unless (@callers) {
          print "No matches\n";
          exit(0);
      }
      
      my @cocci = (
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISLNK(E->d_inode->i_mode)',
          '+ d_is_symlink(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISDIR(E->d_inode->i_mode)',
          '+ d_is_dir(E)',
          '',
          '@@',
          'expression E;',
          '@@',
          '',
          '- S_ISREG(E->d_inode->i_mode)',
          '+ d_is_reg(E)' );
      
      my $coccifile = "tmp.sp.cocci";
      open($fd, ">$coccifile") || die $coccifile;
      print($fd "$_\n") || die $coccifile foreach (@cocci);
      close($fd);
      
      foreach my $file (@callers) {
          chomp $file;
          print "Processing ", $file, "\n";
          system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
      	die "spatch failed";
      }
      
      [AV: overlayfs parts skipped]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e36cb0b8
  6. 19 12月, 2014 1 次提交
    • S
      hfsplus: fix longname handling · 89ac9b4d
      Sougata Santra 提交于
      Longname is not correctly handled by hfsplus driver.  If an attempt to
      create a longname(>255) file/directory is made, it succeeds by creating a
      file/directory with HFSPLUS_MAX_STRLEN and incorrect catalog key.  Thus
      leaving the volume in an inconsistent state.  This patch fixes this issue.
      
      Although lookup is always called first to create a negative entry, so just
      doing a check in lookup would probably fix this issue.  I choose to
      propagate error to other iops as well.
      
      Please NOTE: I have factored out hfsplus_cat_build_key_with_cnid from
      hfsplus_cat_build_key, to avoid unncessary branching.
      
      Thanks a lot.
      
        TEST:
        ------
        dir="TEST_DIR"
        cdir=`pwd`
        name255="_123456789_123456789_123456789_123456789_123456789_123456789\
        _123456789_123456789_123456789_123456789_123456789_123456789_123456789\
        _123456789_123456789_123456789_123456789_123456789_123456789_123456789\
        _123456789_123456789_123456789_123456789_123456789_1234"
        name256="${name255}5"
      
        mkdir $dir
        cd $dir
        touch $name255
        rm -f $name255
        touch $name256
        ls -la
        cd $cdir
        rm -rf $dir
      
        RESULT:
        -------
        [sougata@ultrabook tmp]$ cdir=`pwd`
        [sougata@ultrabook tmp]$
        name255="_123456789_123456789_123456789_123456789_123456789_123456789\
         > _123456789_123456789_123456789_123456789_123456789_123456789_123456789\
         > _123456789_123456789_123456789_123456789_123456789_123456789_123456789\
         > _123456789_123456789_123456789_123456789_123456789_1234"
        [sougata@ultrabook tmp]$ name256="${name255}5"
        [sougata@ultrabook tmp]$
        [sougata@ultrabook tmp]$ mkdir $dir
        [sougata@ultrabook tmp]$ cd $dir
        [sougata@ultrabook TEST_DIR]$ touch $name255
        [sougata@ultrabook TEST_DIR]$ rm -f $name255
        [sougata@ultrabook TEST_DIR]$ touch $name256
        [sougata@ultrabook TEST_DIR]$ ls -la
        ls: cannot access
        _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_1234:
        No such file or directory
        total 0
        drwxrwxr-x 1 sougata sougata 3 Feb 20 19:56 .
        drwxrwxrwx 1 root    root    6 Feb 20 19:56 ..
        -????????? ? ?       ?       ?            ?
        _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_1234
        [sougata@ultrabook TEST_DIR]$ cd $cdir
        [sougata@ultrabook tmp]$ rm -rf $dir
        rm: cannot remove `TEST_DIR': Directory not empty
      
      -ENAMETOOLONG returned from hfsplus_asc2uni was not propaged to iops.
      This allowed hfsplus to create files/directories with HFSPLUS_MAX_STRLEN
      and incorrect keys, leaving the FS in an inconsistent state.  This patch
      fixes this issue.
      Signed-off-by: NSougata Santra <sougata@tuxera.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      89ac9b4d
  7. 07 6月, 2014 12 次提交
    • C
      hfsplus: fix compiler warning on PowerPC · df3d4e7a
      Christian Kujau 提交于
      Commit a99b7069 ("hfsplus: Fix undefined __divdi3 in
      hfsplus_init_header_node()") introduced do_div() to xattr.c and the
      warning below too.
      
      As Geert remarked: "tmp" is "loff_t" which is "__kernel_loff_t", which
      is "long long", i.e.  signed, while include/asm-generic/div64.h compares
      its type with "uint64_t".  As inode sizes are positive, it should be
      safe to change the type of "tmp" to "u64".
      
        In file included from
        arch/powerpc/include/asm/div64.h:1:0,
                          from include/linux/kernel.h:124,
                          from include/asm-generic/bug.h:13,
                          from arch/powerpc/include/asm/bug.h:127,
                          from include/linux/bug.h:4,
                          from include/linux/thread_info.h:11,
                          from include/asm-generic/preempt.h:4,
                          from arch/powerpc/include/generated/asm/preempt.h:1,
                          from include/linux/preempt.h:18,
                          from include/linux/spinlock.h:50,
                          from include/linux/wait.h:8,
                          from include/linux/fs.h:6,
                          from fs/hfsplus/hfsplus_fs.h:19,
                          from fs/hfsplus/xattr.c:9:
        fs/hfsplus/xattr.c: In function 'hfsplus_init_header_node':
        include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default]
           (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                                     ^
        fs/hfsplus/xattr.c:86:2: note: in expansion of macro 'do_div'
           do_div(tmp, node_size);
           ^
      Signed-off-by: NChristian Kujau <lists@nerdbynature.de>
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NSergei Antonov <saproj@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      df3d4e7a
    • F
    • S
      hfsplus: coding style fix for declarations in hfsplus_fs.h · ffbc0671
      Sergei Antonov 提交于
      Some function declarations in hfsplus_fs.h were with argument names,
      some without, and some were mixed.  This patch adds argument names
      everywhere, sorts function in order they go in .c files, and moves
      hfs_part_find() to a proper section.
      
      Auto-formatting and sorting was done with:
      cfunctions *.c | indent -linux | sed "s| \* | \*|"
      Signed-off-by: NSergei Antonov <saproj@gmail.com>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ffbc0671
    • F
      fs/hfsplus/wrapper.c: replace shift loop by ilog2 · 297cc272
      Fabian Frederick 提交于
      Replace while blocksize;shift by ilog2
      Signed-off-by: NFabian Frederick <fabf@skynet.be>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      297cc272
    • S
      hfsplus: fix "unused node is not erased" error · 2cd282a1
      Sergei Antonov 提交于
      Zero newly allocated extents in the catalog tree if volume attributes
      tell us to.  Not doing so we risk getting the "unused node is not
      erased" error.  See kHFSUnusedNodeFix flag in Apple's source code for
      reference.
      
      There was a previous commit clearing the node when it is freed: commit
      899bed05 ("hfsplus: fix issue with unzeroed unused b-tree nodes").
      But it did not handle newly allocated extents (this patch fixes it).
      And it zeroed nodes in all trees unconditionally which is an overkill.
      
      This patch adds a condition and also switches to 'tree->node_size' as a
      simpler method of getting the length to zero.
      Signed-off-by: NSergei Antonov <saproj@gmail.com>
      Cc: Anton Altaparmakov <aia21@cam.ac.uk>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
      Cc: Kyle Laracey <kalaracey@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2cd282a1
    • F
      fs/hfsplus/wrapper.c: replace min/casting by min_t · 915ab236
      Fabian Frederick 提交于
      Also add * before function comments (it was not detected by kernel-doc)
      Signed-off-by: NFabian Frederick <fabf@skynet.be>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      915ab236
    • F
      fs/hfsplus/options.c: replace seq_printf by seq_puts · d8983ca0
      Fabian Frederick 提交于
      Replace seq_printf where possible
      Signed-off-by: NFabian Frederick <fabf@skynet.be>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d8983ca0
    • F
      fs/hfsplus/bnode.c: replace min/casting by min_t · e46707d1
      Fabian Frederick 提交于
      Also fixes some pr_ formats
      Signed-off-by: NFabian Frederick <fabf@skynet.be>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e46707d1
    • S
      hfsplus: emit proper file type from readdir · 97a62eae
      Sergei Antonov 提交于
      hfsplus_readdir() incorrectly returned DT_REG for symbolic links and
      special files.  Return DT_REG, DT_LNK, DT_FIFO, DT_CHR, DT_BLK, DT_SOCK,
      or DT_UNKNOWN according to mode field in catalog record.  Programs
      relying on information from readdir will now work correctly with HFS+.
      Signed-off-by: NSergei Antonov <saproj@gmail.com>
      Cc: Anton Altaparmakov <aia21@cam.ac.uk>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      97a62eae
    • H
      hfsplus: remove unused routine hfsplus_attr_build_key_uni · 7f2fc81e
      Hin-Tak Leung 提交于
      The directory/file catalog b-tree equivalent, hfsplus_build_key_uni(),
      is used by hfsplus_find_cat() for internal referencing between catalog
      records.  There is no corresponding usage for attributes - attribute
      records do not refer to one another.
      Signed-off-by: NHin-Tak Leung <htl10@users.sourceforge.net>
      Cc: Sougata Santra <sougata@tuxera.com>
      Cc: Anton Altaparmakov <anton@tuxera.com>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7f2fc81e
    • H
      hfsplus: correct usage of HFSPLUS_ATTR_MAX_STRLEN for non-English attributes · bf29e886
      Hin-Tak Leung 提交于
      HFSPLUS_ATTR_MAX_STRLEN (=127) is the limit of attribute names for the
      number of unicode character (UTF-16BE) storable in the HFS+ file system.
      Almost all the current usage of it is wrong, in relation to NLS to
      on-disk conversion.
      
      Except for one use calling hfsplus_asc2uni (which should stay the same)
      and its uses in calling hfsplus_uni2asc (which was corrected in the
      earlier patch in this series concerning usage of hfsplus_uni2asc), all
      the other uses are of the forms:
      
      - char buffer[size]
      
      - bound check: "if (namespace_adjusted_input_length > size) return failure;"
      
      Conversion between on-disk unicode representation and NLS char strings
      (in whichever direction) always needs to accommodate the worst-case NLS
      conversion, so all char buffers of that size need to have a
      NLS_MAX_CHARSET_SIZE x .
      
      The bound checks are all wrong, since they compare nls_length derived
      from strlen() to a unicode length limit.
      
      It turns out that all the bound-checks do is to protect
      hfsplus_asc2uni(), which can fail if the input is too large.
      
      There is only one usage of it as far as attributes are concerned, in
      hfsplus_attr_build_key().  It is in turn used by hfsplus_find_attr(),
      hfsplus_create_attr(), hfsplus_delete_attr().  Thus making sure that
      errors from hfsplus_asc2uni() is caught in hfsplus_attr_build_key() and
      propagated is sufficient to replace all the bound checks.
      
      Unpropagated errors from hfsplus_asc2uni() in the file catalog code was
      addressed recently in an independent patch "hfsplus: fix longname
      handling" by Sougata Santra.
      
      Before this patch, trying to set a 55 CJK character (in a UTF-8 locale,
      > 127/3=42) attribute plus user prefix fails with:
      
          $ setfattr -n user.`cat testing-string` -v `cat testing-string` \
              testing-string
          setfattr: testing-string: Operation not supported
      
      and retrieving a stored long attributes is particular ugly(!):
      
          find /mnt/* -type f -exec getfattr -d {} \;
          getfattr: /mnt/testing-string: Input/output error
      
      with console log:
          [268008.389781] hfsplus: unicode conversion failed
      
      After the patch, both of the above works.
      
      FYI, the test attribute string is prepared with:
      
      echo -e -n \
      "\xe9\x80\x99\xe6\x98\xaf\xe4\xb8\x80\xe5\x80\x8b\xe9\x9d\x9e\xe5" \
      "\xb8\xb8\xe6\xbc\xab\xe9\x95\xb7\xe8\x80\x8c\xe6\xa5\xb5\xe5\x85" \
      "\xb6\xe4\xb9\x8f\xe5\x91\xb3\xe5\x92\x8c\xe7\x9b\xb8\xe7\x95\xb6" \
      "\xe7\x84\xa1\xe8\xb6\xa3\xe3\x80\x81\xe4\xbb\xa5\xe5\x8f\x8a\xe7" \
      "\x84\xa1\xe7\x94\xa8\xe7\x9a\x84\xe3\x80\x81\xe5\x86\x8d\xe5\x8a" \
      "\xa0\xe4\xb8\x8a\xe6\xaf\xab\xe7\x84\xa1\xe6\x84\x8f\xe7\xbe\xa9" \
      "\xe7\x9a\x84\xe6\x93\xb4\xe5\xb1\x95\xe5\xb1\xac\xe6\x80\xa7\xef" \
      "\xbc\x8c\xe8\x80\x8c\xe5\x85\xb6\xe5\x94\xaf\xe4\xb8\x80\xe5\x89" \
      "\xb5\xe5\xbb\xba\xe7\x9b\xae\xe7\x9a\x84\xe5\x83\x85\xe6\x98\xaf" \
      "\xe7\x82\xba\xe4\xba\x86\xe6\xb8\xac\xe8\xa9\xa6\xe4\xbd\x9c\xe7" \
      "\x94\xa8\xe3\x80\x82" | tr -d ' '
      
      (= "pointlessly long attribute for testing", elaborate Chinese in
      UTF-8 enoding).
      
      However, it is not possible to set double the size (110 + 5 is still
      under 127) in a UTF-8 locale:
      
          $setfattr -n user.`cat testing-string testing-string` -v \
              `cat testing-string testing-string` testing-string
          setfattr: testing-string: Numerical result out of range
      
      110 CJK char in UTF-8 is 330 bytes - the generic get/set attribute
      system call code in linux/fs/xattr.c imposes a 255 byte limit.  One can
      use a combination of iconv to encode content, changing terminal locale
      for viewing, and an nls=cp932/cp936/cp949/cp950 mount option to fully
      use 127-unicode attribute in a double-byte locale.
      
      Also, as an additional information, it is possible to (mis-)use unicode
      half-width/full-width forms (U+FFxx) to write attributes which looks
      like english but not actually ascii.
      
      Thanks Anton Altaparmakov for reviewing the earlier ideas behind this
      change.
      
      [akpm@linux-foundation.org: fix build]
      [akpm@linux-foundation.org: fix build]
      Signed-off-by: NHin-Tak Leung <htl10@users.sourceforge.net>
      Cc: Anton Altaparmakov <anton@tuxera.com>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Sougata Santra <sougata@tuxera.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bf29e886
    • H
      hfsplus: fix worst-case unicode to char conversion of file names and attributes · 017f8da4
      Hin-Tak Leung 提交于
      This is a series of 3 patches which corrects issues in HFS+ concerning
      the use of non-english file names and attributes.  Names and attributes
      are stored internally as UTF-16 units up to a fixed maximum size, and
      convert to and from user-representation by NLS.  The code incorrectly
      assume that NLS string lengths are equal to unicode lengths, which is
      only true for English ascii usage.
      
      This patch (of 3):
      
      The HFS Plus Volume Format specification (TN1150) states that file names
      are stored internally as a maximum of 255 unicode characters, as defined
      by The Unicode Standard, Version 2.0 [Unicode, Inc.  ISBN
      0-201-48345-9].  File names are converted by the NLS system on Linux
      before presented to the user.
      
      255 CJK characters converts to UTF-8 with 1 unicode character to up to 3
      bytes, and to GB18030 with 1 unicode character to up to 4 bytes.  Thus,
      trying in a UTF-8 locale to list files with names of more than 85 CJK
      characters results in:
      
          $ ls /mnt
          ls: reading directory /mnt: File name too long
      
      The receiving buffer to hfsplus_uni2asc() needs to be 255 x
      NLS_MAX_CHARSET_SIZE bytes, not 255 bytes as the code has always been.
      
      Similar consideration applies to attributes, which are stored internally
      as a maximum of 127 UTF-16BE units.  See XNU source for an up-to-date
      reference on attributes.
      
      Strictly speaking, the maximum value of NLS_MAX_CHARSET_SIZE = 6 is not
      attainable in the case of conversion to UTF-8, as going beyond 3 bytes
      requires the use of surrogate pairs, i.e.  consuming two input units.
      
      Thanks Anton Altaparmakov for reviewing an earlier version of this
      change.
      
      This patch fixes all callers of hfsplus_uni2asc(), and also enables the
      use of long non-English file names in HFS+.  The getting and setting,
      and general usage of long non-English attributes requires further
      forthcoming work, in the following patches of this series.
      
      [akpm@linux-foundation.org: fix build]
      Signed-off-by: NHin-Tak Leung <htl10@users.sourceforge.net>
      Reviewed-by: NAnton Altaparmakov <anton@tuxera.com>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Sougata Santra <sougata@tuxera.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      017f8da4
  8. 07 5月, 2014 5 次提交
  9. 04 4月, 2014 4 次提交
  10. 13 3月, 2014 1 次提交
    • T
      fs: push sync_filesystem() down to the file system's remount_fs() · 02b9984d
      Theodore Ts'o 提交于
      Previously, the no-op "mount -o mount /dev/xxx" operation when the
      file system is already mounted read-write causes an implied,
      unconditional syncfs().  This seems pretty stupid, and it's certainly
      documented or guaraunteed to do this, nor is it particularly useful,
      except in the case where the file system was mounted rw and is getting
      remounted read-only.
      
      However, it's possible that there might be some file systems that are
      actually depending on this behavior.  In most file systems, it's
      probably fine to only call sync_filesystem() when transitioning from
      read-write to read-only, and there are some file systems where this is
      not needed at all (for example, for a pseudo-filesystem or something
      like romfs).
      Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Artem Bityutskiy <dedekind1@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Evgeniy Dushistov <dushistov@mail.ru>
      Cc: Jan Kara <jack@suse.cz>
      Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Cc: Anders Larsen <al@alarsen.net>
      Cc: Phillip Lougher <phillip@squashfs.org.uk>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
      Cc: Petr Vandrovec <petr@vandrovec.name>
      Cc: xfs@oss.sgi.com
      Cc: linux-btrfs@vger.kernel.org
      Cc: linux-cifs@vger.kernel.org
      Cc: samba-technical@lists.samba.org
      Cc: codalist@coda.cs.cmu.edu
      Cc: linux-ext4@vger.kernel.org
      Cc: linux-f2fs-devel@lists.sourceforge.net
      Cc: fuse-devel@lists.sourceforge.net
      Cc: cluster-devel@redhat.com
      Cc: linux-mtd@lists.infradead.org
      Cc: jfs-discussion@lists.sourceforge.net
      Cc: linux-nfs@vger.kernel.org
      Cc: linux-nilfs@vger.kernel.org
      Cc: linux-ntfs-dev@lists.sourceforge.net
      Cc: ocfs2-devel@oss.oracle.com
      Cc: reiserfs-devel@vger.kernel.org
      02b9984d