Merge branch 'master' into for-next
authorJiri Kosina <jkosina@suse.cz>
Mon, 18 Apr 2016 09:18:55 +0000 (11:18 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 18 Apr 2016 09:18:55 +0000 (11:18 +0200)
Sync with Linus' tree so that patches against newer codebase can be applied.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1  2 
fs/jbd2/recovery.c
fs/jbd2/transaction.c
fs/super.c

diff --combined fs/jbd2/recovery.c
index 76579c28edc78eb3789e3865489d8faa65ea8c6f,08a456b96e4ef475d5212f136d69e8975aba86b4..805bc6bcd8abb0a6484ef1e808be98bbd51a6295
@@@ -174,8 -174,7 +174,7 @@@ static int jread(struct buffer_head **b
        return 0;
  }
  
- static int jbd2_descr_block_csum_verify(journal_t *j,
-                                       void *buf)
+ static int jbd2_descriptor_block_csum_verify(journal_t *j, void *buf)
  {
        struct jbd2_journal_block_tail *tail;
        __be32 provided;
@@@ -304,7 -303,7 +303,7 @@@ int jbd2_journal_recover(journal_t *jou
   * Locate any valid recovery information from the journal and set up the
   * journal structures in memory to ignore it (presumably because the
   * caller has evidence that it is out of date).
 - * This function does'nt appear to be exorted..
 + * This function doesn't appear to be exported..
   *
   * We perform one pass over the journal to allow us to tell the user how
   * much recovery information is being erased, and to let us initialise
@@@ -522,8 -521,8 +521,8 @@@ static int do_one_pass(journal_t *journ
                                descr_csum_size =
                                        sizeof(struct jbd2_journal_block_tail);
                        if (descr_csum_size > 0 &&
-                           !jbd2_descr_block_csum_verify(journal,
-                                                         bh->b_data)) {
+                           !jbd2_descriptor_block_csum_verify(journal,
+                                                              bh->b_data)) {
                                printk(KERN_ERR "JBD2: Invalid checksum "
                                       "recovering block %lu in log\n",
                                       next_log_block);
        return err;
  }
  
- static int jbd2_revoke_block_csum_verify(journal_t *j,
-                                        void *buf)
- {
-       struct jbd2_journal_revoke_tail *tail;
-       __be32 provided;
-       __u32 calculated;
-       if (!jbd2_journal_has_csum_v2or3(j))
-               return 1;
-       tail = (struct jbd2_journal_revoke_tail *)(buf + j->j_blocksize -
-                       sizeof(struct jbd2_journal_revoke_tail));
-       provided = tail->r_checksum;
-       tail->r_checksum = 0;
-       calculated = jbd2_chksum(j, j->j_csum_seed, buf, j->j_blocksize);
-       tail->r_checksum = provided;
-       return provided == cpu_to_be32(calculated);
- }
  /* Scan a revoke record, marking all blocks mentioned as revoked. */
  
  static int scan_revoke_records(journal_t *journal, struct buffer_head *bh,
        offset = sizeof(jbd2_journal_revoke_header_t);
        rcount = be32_to_cpu(header->r_count);
  
-       if (!jbd2_revoke_block_csum_verify(journal, header))
+       if (!jbd2_descriptor_block_csum_verify(journal, header))
                return -EFSBADCRC;
  
        if (jbd2_journal_has_csum_v2or3(journal))
-               csum_size = sizeof(struct jbd2_journal_revoke_tail);
+               csum_size = sizeof(struct jbd2_journal_block_tail);
        if (rcount > journal->j_blocksize - csum_size)
                return -EINVAL;
        max = rcount;
diff --combined fs/jbd2/transaction.c
index 98d04c5fe3d21ca42b180130abab80fc70c0db9b,67c103867bf8d5d27e84a4eb2ad2c8a09b22d328..2c56c3e3219463b165828c7c9c1d2a4ab8ef608e
@@@ -543,7 -543,7 +543,7 @@@ EXPORT_SYMBOL(jbd2_journal_start_reserv
   *
   * Some transactions, such as large extends and truncates, can be done
   * atomically all at once or in several stages.  The operation requests
 - * a credit for a number of buffer modications in advance, but can
 + * a credit for a number of buffer modifications in advance, but can
   * extend its credit if it needs more.
   *
   * jbd2_journal_extend tries to give the running handle more buffer credits.
@@@ -627,7 -627,7 +627,7 @@@ error_out
   * If the jbd2_journal_extend() call above fails to grant new buffer credits
   * to a running handle, a call to jbd2_journal_restart will commit the
   * handle's transaction so far and reattach the handle to a new
 - * transaction capabable of guaranteeing the requested number of
 + * transaction capable of guaranteeing the requested number of
   * credits. We preserve reserved handle if there's any attached to the
   * passed in handle.
   */
@@@ -764,13 -764,11 +764,11 @@@ void jbd2_journal_unlock_updates (journ
  
  static void warn_dirty_buffer(struct buffer_head *bh)
  {
-       char b[BDEVNAME_SIZE];
        printk(KERN_WARNING
-              "JBD2: Spotted dirty metadata buffer (dev = %s, blocknr = %llu). "
+              "JBD2: Spotted dirty metadata buffer (dev = %pg, blocknr = %llu). "
               "There's a risk of filesystem corruption in case of system "
               "crash.\n",
-              bdevname(bh->b_bdev, b), (unsigned long long)bh->b_blocknr);
+              bh->b_bdev, (unsigned long long)bh->b_blocknr);
  }
  
  /* Call t_frozen trigger and copy buffer data into jh->b_frozen_data. */
@@@ -968,14 -966,8 +966,8 @@@ repeat
                if (!frozen_buffer) {
                        JBUFFER_TRACE(jh, "allocate memory for buffer");
                        jbd_unlock_bh_state(bh);
-                       frozen_buffer = jbd2_alloc(jh2bh(jh)->b_size, GFP_NOFS);
-                       if (!frozen_buffer) {
-                               printk(KERN_ERR "%s: OOM for frozen_buffer\n",
-                                      __func__);
-                               JBUFFER_TRACE(jh, "oom!");
-                               error = -ENOMEM;
-                               goto out;
-                       }
+                       frozen_buffer = jbd2_alloc(jh2bh(jh)->b_size,
+                                                  GFP_NOFS | __GFP_NOFAIL);
                        goto repeat;
                }
                jh->b_frozen_data = frozen_buffer;
@@@ -1009,7 -1001,8 +1001,8 @@@ out
  }
  
  /* Fast check whether buffer is already attached to the required transaction */
- static bool jbd2_write_access_granted(handle_t *handle, struct buffer_head *bh)
+ static bool jbd2_write_access_granted(handle_t *handle, struct buffer_head *bh,
+                                                       bool undo)
  {
        struct journal_head *jh;
        bool ret = false;
        jh = READ_ONCE(bh->b_private);
        if (!jh)
                goto out;
+       /* For undo access buffer must have data copied */
+       if (undo && !jh->b_committed_data)
+               goto out;
        if (jh->b_transaction != handle->h_transaction &&
            jh->b_next_transaction != handle->h_transaction)
                goto out;
@@@ -1073,7 -1069,7 +1069,7 @@@ int jbd2_journal_get_write_access(handl
        struct journal_head *jh;
        int rc;
  
-       if (jbd2_write_access_granted(handle, bh))
+       if (jbd2_write_access_granted(handle, bh, false))
                return 0;
  
        jh = jbd2_journal_add_journal_head(bh);
@@@ -1210,7 -1206,7 +1206,7 @@@ int jbd2_journal_get_undo_access(handle
        char *committed_data = NULL;
  
        JBUFFER_TRACE(jh, "entry");
-       if (jbd2_write_access_granted(handle, bh))
+       if (jbd2_write_access_granted(handle, bh, true))
                return 0;
  
        jh = jbd2_journal_add_journal_head(bh);
                goto out;
  
  repeat:
-       if (!jh->b_committed_data) {
-               committed_data = jbd2_alloc(jh2bh(jh)->b_size, GFP_NOFS);
-               if (!committed_data) {
-                       printk(KERN_ERR "%s: No memory for committed data\n",
-                               __func__);
-                       err = -ENOMEM;
-                       goto out;
-               }
-       }
+       if (!jh->b_committed_data)
+               committed_data = jbd2_alloc(jh2bh(jh)->b_size,
+                                           GFP_NOFS|__GFP_NOFAIL);
  
        jbd_lock_bh_state(bh);
        if (!jh->b_committed_data) {
@@@ -1596,7 -1586,7 +1586,7 @@@ drop
  
  /**
   * int jbd2_journal_stop() - complete a transaction
 - * @handle: tranaction to complete.
 + * @handle: transaction to complete.
   *
   * All done for a particular handle.
   *
@@@ -1937,8 -1927,8 +1927,8 @@@ out
   * @journal: journal for operation
   * @page: to try and free
   * @gfp_mask: we use the mask to detect how hard should we try to release
-  * buffers. If __GFP_WAIT and __GFP_FS is set, we wait for commit code to
-  * release the buffers.
+  * buffers. If __GFP_DIRECT_RECLAIM and __GFP_FS is set, we wait for commit
+  * code to release the buffers.
   *
   *
   * For all the buffers on this page,
@@@ -2152,6 -2142,7 +2142,7 @@@ static int journal_unmap_buffer(journal
  
                if (!buffer_dirty(bh)) {
                        /* bdflush has written it.  We can drop it now */
+                       __jbd2_journal_remove_checkpoint(jh);
                        goto zap_buffer;
                }
  
                                /* The orphan record's transaction has
                                 * committed.  We can cleanse this buffer */
                                clear_buffer_jbddirty(bh);
+                               __jbd2_journal_remove_checkpoint(jh);
                                goto zap_buffer;
                        }
                }
@@@ -2271,7 -2263,7 +2263,7 @@@ int jbd2_journal_invalidatepage(journal
        struct buffer_head *head, *bh, *next;
        unsigned int stop = offset + length;
        unsigned int curr_off = 0;
-       int partial_page = (offset || length < PAGE_CACHE_SIZE);
+       int partial_page = (offset || length < PAGE_SIZE);
        int may_free = 1;
        int ret = 0;
  
        if (!page_has_buffers(page))
                return 0;
  
-       BUG_ON(stop > PAGE_CACHE_SIZE || stop < length);
+       BUG_ON(stop > PAGE_SIZE || stop < length);
  
        /* We will potentially be playing with lists other than just the
         * data lists (especially for journaled data mode), so be
diff --combined fs/super.c
index 6cd9f719cf612e9beb3da39d33054dec4a55779f,74914b1bae70ff09d451450cb596fb3b5639d969..d78b9847e6cbc63f0f74231cf58519a98e38a35d
@@@ -285,7 -285,7 +285,7 @@@ static void put_super(struct super_bloc
   *    deactivate_locked_super -       drop an active reference to superblock
   *    @s: superblock to deactivate
   *
 - *    Drops an active reference to superblock, converting it into a temprory
 + *    Drops an active reference to superblock, converting it into a temporary
   *    one if there is no other active references left.  In that case we
   *    tell fs driver to shut it down and drop the temporary reference we
   *    had just acquired.
@@@ -415,6 -415,7 +415,7 @@@ void generic_shutdown_super(struct supe
                sb->s_flags &= ~MS_ACTIVE;
  
                fsnotify_unmount_inodes(sb);
+               cgroup_writeback_umount();
  
                evict_inodes(sb);
  
@@@ -1012,10 -1013,8 +1013,8 @@@ struct dentry *mount_bdev(struct file_s
                blkdev_put(bdev, mode);
                down_write(&s->s_umount);
        } else {
-               char b[BDEVNAME_SIZE];
                s->s_mode = mode;
-               strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
+               snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
                sb_set_blocksize(s, block_size(bdev));
                error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
                if (error) {
This page took 0.0338 seconds and 5 git commands to generate.