~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to fs/xfs/xfs_vnodeops.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
953
953
                 * If we previously truncated this file and removed old data
954
954
                 * in the process, we want to initiate "early" writeout on
955
955
                 * the last close.  This is an attempt to combat the notorious
956
 
                 * NULL files problem which is particularly noticable from a
 
956
                 * NULL files problem which is particularly noticeable from a
957
957
                 * truncate down, buffered (re-)write (delalloc), followed by
958
958
                 * a crash.  What we are effectively doing here is
959
959
                 * significantly reducing the time window where we'd otherwise
982
982
                 *
983
983
                 * Further, check if the inode is being opened, written and
984
984
                 * closed frequently and we have delayed allocation blocks
985
 
                 * oustanding (e.g. streaming writes from the NFS server),
 
985
                 * outstanding (e.g. streaming writes from the NFS server),
986
986
                 * truncating the blocks past EOF will cause fragmentation to
987
987
                 * occur.
988
988
                 *
1189
1189
                 * inode might be lost for a long time or forever.
1190
1190
                 */
1191
1191
                if (!XFS_FORCED_SHUTDOWN(mp)) {
1192
 
                        cmn_err(CE_NOTE,
1193
 
                "xfs_inactive:  xfs_ifree() returned an error = %d on %s",
1194
 
                                error, mp->m_fsname);
 
1192
                        xfs_notice(mp, "%s: xfs_ifree returned error %d",
 
1193
                                __func__, error);
1195
1194
                        xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
1196
1195
                }
1197
1196
                xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT);
1208
1207
                 */
1209
1208
                error = xfs_bmap_finish(&tp,  &free_list, &committed);
1210
1209
                if (error)
1211
 
                        xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: "
1212
 
                                "xfs_bmap_finish() returned error %d", error);
 
1210
                        xfs_notice(mp, "%s: xfs_bmap_finish returned error %d",
 
1211
                                __func__, error);
1213
1212
                error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
1214
1213
                if (error)
1215
 
                        xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: "
1216
 
                                "xfs_trans_commit() returned error %d", error);
 
1214
                        xfs_notice(mp, "%s: xfs_trans_commit returned error %d",
 
1215
                                __func__, error);
1217
1216
        }
1218
1217
 
1219
1218
        /*
1310
1309
        error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid,
1311
1310
                        XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
1312
1311
        if (error)
1313
 
                goto std_return;
 
1312
                return error;
1314
1313
 
1315
1314
        if (is_dir) {
1316
1315
                rdev = 0;
1390
1389
        }
1391
1390
 
1392
1391
        /*
1393
 
         * At this point, we've gotten a newly allocated inode.
1394
 
         * It is locked (and joined to the transaction).
1395
 
         */
1396
 
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
1397
 
 
1398
 
        /*
1399
1392
         * Now we join the directory inode to the transaction.  We do not do it
1400
1393
         * earlier because xfs_dir_ialloc might commit the previous transaction
1401
1394
         * (and release all the locks).  An error from here on will result in
1440
1433
         */
1441
1434
        xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp);
1442
1435
 
1443
 
        /*
1444
 
         * xfs_trans_commit normally decrements the vnode ref count
1445
 
         * when it unlocks the inode. Since we want to return the
1446
 
         * vnode to the caller, we bump the vnode ref count now.
1447
 
         */
1448
 
        IHOLD(ip);
1449
 
 
1450
1436
        error = xfs_bmap_finish(&tp, &free_list, &committed);
1451
1437
        if (error)
1452
 
                goto out_abort_rele;
 
1438
                goto out_bmap_cancel;
1453
1439
 
1454
1440
        error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
1455
 
        if (error) {
1456
 
                IRELE(ip);
1457
 
                goto out_dqrele;
1458
 
        }
 
1441
        if (error)
 
1442
                goto out_release_inode;
1459
1443
 
1460
1444
        xfs_qm_dqrele(udqp);
1461
1445
        xfs_qm_dqrele(gdqp);
1469
1453
        cancel_flags |= XFS_TRANS_ABORT;
1470
1454
 out_trans_cancel:
1471
1455
        xfs_trans_cancel(tp, cancel_flags);
1472
 
 out_dqrele:
1473
 
        xfs_qm_dqrele(udqp);
1474
 
        xfs_qm_dqrele(gdqp);
1475
 
 
1476
 
        if (unlock_dp_on_error)
1477
 
                xfs_iunlock(dp, XFS_ILOCK_EXCL);
1478
 
 std_return:
1479
 
        return error;
1480
 
 
1481
 
 out_abort_rele:
 
1456
 out_release_inode:
1482
1457
        /*
1483
1458
         * Wait until after the current transaction is aborted to
1484
1459
         * release the inode.  This prevents recursive transactions
1485
1460
         * and deadlocks from xfs_inactive.
1486
1461
         */
1487
 
        xfs_bmap_cancel(&free_list);
1488
 
        cancel_flags |= XFS_TRANS_ABORT;
1489
 
        xfs_trans_cancel(tp, cancel_flags);
1490
 
        IRELE(ip);
1491
 
        unlock_dp_on_error = B_FALSE;
1492
 
        goto out_dqrele;
 
1462
        if (ip)
 
1463
                IRELE(ip);
 
1464
 
 
1465
        xfs_qm_dqrele(udqp);
 
1466
        xfs_qm_dqrele(gdqp);
 
1467
 
 
1468
        if (unlock_dp_on_error)
 
1469
                xfs_iunlock(dp, XFS_ILOCK_EXCL);
 
1470
        return error;
1493
1471
}
1494
1472
 
1495
1473
#ifdef DEBUG
2114
2092
                                  XFS_BMAPI_WRITE | XFS_BMAPI_METADATA,
2115
2093
                                  &first_block, resblks, mval, &nmaps,
2116
2094
                                  &free_list);
2117
 
                if (error) {
2118
 
                        goto error1;
2119
 
                }
 
2095
                if (error)
 
2096
                        goto error2;
2120
2097
 
2121
2098
                if (resblks)
2122
2099
                        resblks -= fs_blocks;
2148
2125
        error = xfs_dir_createname(tp, dp, link_name, ip->i_ino,
2149
2126
                                        &first_block, &free_list, resblks);
2150
2127
        if (error)
2151
 
                goto error1;
 
2128
                goto error2;
2152
2129
        xfs_trans_ichgtime(tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
2153
2130
        xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
2154
2131
 
2161
2138
                xfs_trans_set_sync(tp);
2162
2139
        }
2163
2140
 
2164
 
        /*
2165
 
         * xfs_trans_commit normally decrements the vnode ref count
2166
 
         * when it unlocks the inode. Since we want to return the
2167
 
         * vnode to the caller, we bump the vnode ref count now.
2168
 
         */
2169
 
        IHOLD(ip);
2170
 
 
2171
2141
        error = xfs_bmap_finish(&tp, &free_list, &committed);
2172
2142
        if (error) {
2173
2143
                goto error2;
2861
2831
                ip->i_d.di_flags &= ~XFS_DIFLAG_PREALLOC;
2862
2832
 
2863
2833
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
2864
 
        xfs_trans_set_sync(tp);
 
2834
        if (attr_flags & XFS_ATTR_SYNC)
 
2835
                xfs_trans_set_sync(tp);
2865
2836
 
2866
2837
        error = xfs_trans_commit(tp, 0);
2867
2838