~ubuntu-branches/ubuntu/saucy/linux-ppc/saucy

« back to all changes in this revision

Viewing changes to fs/nfs/pnfs.c

  • Committer: Package Import Robot
  • Author(s): Ben Collins, Ubuntu: 3.8.0-17.27
  • Date: 2013-04-08 18:16:48 UTC
  • mfrom: (16.1.9 raring)
  • Revision ID: package-import@ubuntu.com-20130408181648-z7suubhgtq6k6zke
Tags: 3.8.0-8.14
[ Ubuntu: 3.8.0-17.27 ]

* SAUCE: (no-up) Bluetooth: Add support for 04ca:2007
  - LP: #1153448
* SAUCE: (no-up) Bluetooth: Add support for 105b:e065
  - LP: #1161261
* SAUCE: (no-up) tools/power turbostat: additional Haswell CPU-id
  - LP: #1083993
* Revert "SAUCE: (no-up) seccomp: forcing auditing of kill condition"
  Replaced by upstream patch.
* Release Tracking Bug
  - LP: #1165746
* rebase to v3.8.6
* Revert "brcmsmac: support 4313iPA"
  - LP: #1157190
* tools/power turbostat: support Haswell
  - LP: #1083993
* net: calxedaxgmac: fix rx ring handling when OOM
* cpufreq: check OF node /cpus presence before dereferencing it
* Input: cypress_ps2 - fix trackpadi found in Dell XPS12
  - LP: #1103594
* ARM: OMAP2+: Limit omap initcalls to omap only on multiplatform kernels
* ARM: OMAP2+: Use omap initcalls
* ARM: OMAP: Fix i2c cmdline initcall for multiplatform
* ARM: OMAP: Fix dmaengine init for multiplatform
* ARM: OMAP2+: Add multiplatform debug_ll support
* ARM: OMAP2+: Disable code that currently does not work with
  multiplaform
* ARM: OMAP2+: Enable ARCH_MULTIPLATFORM support
* ARM: OMAP2+: Add minimal support for booting vexpress
* ARM: OMAP2+: Remove now obsolete uncompress.h and debug-macro.S
* davinci: do not include mach/hardware.h
* clk: export __clk_get_name for re-use in imx-ipu-v3 and others
* [SCSI] storvsc: avoid usage of WRITE_SAME
  - LP: #1157952
* ACPICA: Fix possible memory leak in dispatcher error path.
* KVM: x86: fix for buffer overflow in handling of MSR_KVM_SYSTEM_TIME (CVE-2013-1796)
  - LP: #1158254
  - CVE-2013-1796
* SAUCE: (no-up) Bluetooth: Add a load_firmware callback to struct hci_dev
  - LP: #1065400
* SAUCE: (no-up) Bluetooth: Implement broadcom patchram firmware loader
  - LP: #1065400
* SAUCE: (no-up) Bluetooth: Add support for 13d3:3388 and 13d3:3389
  - LP: #1065400

Show diffs side-by-side

added added

removed removed

Lines of Context:
417
417
               lo_seg_intersecting(lseg_range, recall_range);
418
418
}
419
419
 
 
420
static bool pnfs_lseg_dec_and_remove_zero(struct pnfs_layout_segment *lseg,
 
421
                struct list_head *tmp_list)
 
422
{
 
423
        if (!atomic_dec_and_test(&lseg->pls_refcount))
 
424
                return false;
 
425
        pnfs_layout_remove_lseg(lseg->pls_layout, lseg);
 
426
        list_add(&lseg->pls_list, tmp_list);
 
427
        return true;
 
428
}
 
429
 
420
430
/* Returns 1 if lseg is removed from list, 0 otherwise */
421
431
static int mark_lseg_invalid(struct pnfs_layout_segment *lseg,
422
432
                             struct list_head *tmp_list)
430
440
                 */
431
441
                dprintk("%s: lseg %p ref %d\n", __func__, lseg,
432
442
                        atomic_read(&lseg->pls_refcount));
433
 
                if (atomic_dec_and_test(&lseg->pls_refcount)) {
434
 
                        pnfs_layout_remove_lseg(lseg->pls_layout, lseg);
435
 
                        list_add(&lseg->pls_list, tmp_list);
 
443
                if (pnfs_lseg_dec_and_remove_zero(lseg, tmp_list))
436
444
                        rv = 1;
437
 
                }
438
445
        }
439
446
        return rv;
440
447
}
777
784
        return lseg;
778
785
}
779
786
 
 
787
static void pnfs_clear_layoutcommit(struct inode *inode,
 
788
                struct list_head *head)
 
789
{
 
790
        struct nfs_inode *nfsi = NFS_I(inode);
 
791
        struct pnfs_layout_segment *lseg, *tmp;
 
792
 
 
793
        if (!test_and_clear_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags))
 
794
                return;
 
795
        list_for_each_entry_safe(lseg, tmp, &nfsi->layout->plh_segs, pls_list) {
 
796
                if (!test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags))
 
797
                        continue;
 
798
                pnfs_lseg_dec_and_remove_zero(lseg, head);
 
799
        }
 
800
}
 
801
 
780
802
/*
781
803
 * Initiates a LAYOUTRETURN(FILE), and removes the pnfs_layout_hdr
782
804
 * when the layout segment list is empty.
808
830
        /* Reference matched in nfs4_layoutreturn_release */
809
831
        pnfs_get_layout_hdr(lo);
810
832
        empty = list_empty(&lo->plh_segs);
 
833
        pnfs_clear_layoutcommit(ino, &tmp_list);
811
834
        pnfs_mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
812
835
        /* Don't send a LAYOUTRETURN if list was initially empty */
813
836
        if (empty) {
820
843
        spin_unlock(&ino->i_lock);
821
844
        pnfs_free_lseg_list(&tmp_list);
822
845
 
823
 
        WARN_ON(test_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags));
824
 
 
825
846
        lrp = kzalloc(sizeof(*lrp), GFP_KERNEL);
826
847
        if (unlikely(lrp == NULL)) {
827
848
                status = -ENOMEM;
1459
1480
        dprintk("pnfs write error = %d\n", hdr->pnfs_error);
1460
1481
        if (NFS_SERVER(hdr->inode)->pnfs_curr_ld->flags &
1461
1482
            PNFS_LAYOUTRET_ON_ERROR) {
1462
 
                clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(hdr->inode)->flags);
1463
1483
                pnfs_return_layout(hdr->inode);
1464
1484
        }
1465
1485
        if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags))
1614
1634
        dprintk("pnfs read error = %d\n", hdr->pnfs_error);
1615
1635
        if (NFS_SERVER(hdr->inode)->pnfs_curr_ld->flags &
1616
1636
            PNFS_LAYOUTRET_ON_ERROR) {
1617
 
                clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(hdr->inode)->flags);
1618
1637
                pnfs_return_layout(hdr->inode);
1619
1638
        }
1620
1639
        if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags))
1747
1766
 
1748
1767
        list_for_each_entry(lseg, &NFS_I(inode)->layout->plh_segs, pls_list) {
1749
1768
                if (lseg->pls_range.iomode == IOMODE_RW &&
1750
 
                    test_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags))
 
1769
                    test_and_clear_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags))
1751
1770
                        list_add(&lseg->pls_lc_list, listp);
1752
1771
        }
1753
1772
}
1754
1773
 
 
1774
static void pnfs_list_write_lseg_done(struct inode *inode, struct list_head *listp)
 
1775
{
 
1776
        struct pnfs_layout_segment *lseg, *tmp;
 
1777
        unsigned long *bitlock = &NFS_I(inode)->flags;
 
1778
 
 
1779
        /* Matched by references in pnfs_set_layoutcommit */
 
1780
        list_for_each_entry_safe(lseg, tmp, listp, pls_lc_list) {
 
1781
                list_del_init(&lseg->pls_lc_list);
 
1782
                pnfs_put_lseg(lseg);
 
1783
        }
 
1784
 
 
1785
        clear_bit_unlock(NFS_INO_LAYOUTCOMMITTING, bitlock);
 
1786
        smp_mb__after_clear_bit();
 
1787
        wake_up_bit(bitlock, NFS_INO_LAYOUTCOMMITTING);
 
1788
}
 
1789
 
1755
1790
void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg)
1756
1791
{
1757
1792
        pnfs_layout_io_set_failed(lseg->pls_layout, lseg->pls_range.iomode);
1796
1831
 
1797
1832
        if (nfss->pnfs_curr_ld->cleanup_layoutcommit)
1798
1833
                nfss->pnfs_curr_ld->cleanup_layoutcommit(data);
 
1834
        pnfs_list_write_lseg_done(data->args.inode, &data->lseg_list);
1799
1835
}
1800
1836
 
1801
1837
/*