~ubuntu-branches/ubuntu/quantal/linux-ti-omap4/quantal

« back to all changes in this revision

Viewing changes to drivers/md/dm-thin-metadata.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Ubuntu: 3.2.0-19.31, Ubuntu: 3.2.0-19.30
  • Date: 2012-03-21 15:23:51 UTC
  • Revision ID: package-import@ubuntu.com-20120321152351-ya52awpl9cmqlwrs
Tags: 3.2.0-1410.13
[ Paolo Pisati ]

* rebased on Ubuntu-3.2.0-19.31

[ Ubuntu: 3.2.0-19.31 ]

* d-i: Add dm-multipath and scsi device handlers
  - LP: #959749
* d-i: Move multipath modules into their own udeb
  - LP: #598251, #959749
* [Config] Auto-detect do_tools setting
* [Config] correctly specify CROSS_COMPILE for tools build
* [Config] CONFIG_DRM_PSB_CDV=n
* Rebase to v3.2.12
* powerpc/pmac: Fix SMP kernels on pre-core99 UP machines
  - LP: #959959
* rebase to v3.2.12

[ Ubuntu: 3.2.0-19.30 ]

* [Config] Fix typeo in the Hyper-V module names
* [Config] Move kernels to "Section: kernel"
  - LP: #499557
* SAUCE: AppArmor: Add ability to load extended policy
* SAUCE: AppArmor: Add the ability to mediate mount
* SAUCE: AppArmor: Add profile introspection file to interface
* SAUCE: AppArmor: basic networking rules
* [Config] Disable CONFIG_SECURITY_TOMOYO_OMIT_USERSPACE_LOADER
  - LP: #952035
* Rebase to v3.2.10
* [Config] Update configs after rebase to v3.2.10
* Rebase to v3.2.11
* [Config] Disable CONFIG_STUB_POULSBO
  - LP: #899244
* [Config] Add CONFIG_DRM_PSB check to enforcer
  - LP: #899244
* [Config] Drop non-SMP powerpc
* net/hyperv: Use the built-in macro KBUILD_MODNAME for this driver
* x86: Derandom delay_tsc for 64 bit
* Bluetooth: Fix l2cap conn failures for ssp devices
  - LP: #872044
* KVM: x86: extend "struct x86_emulate_ops" with "get_cpuid"
  - LP: #917842
  - CVE-2012-0045
* KVM: x86: fix missing checks in syscall emulation
  - LP: #917842
  - CVE-2012-0045
* rebase to v3.2.11
* rebase to v3.2.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
385
385
                data_sm = dm_sm_disk_create(tm, nr_blocks);
386
386
                if (IS_ERR(data_sm)) {
387
387
                        DMERR("sm_disk_create failed");
 
388
                        dm_tm_unlock(tm, sblock);
388
389
                        r = PTR_ERR(data_sm);
389
390
                        goto bad;
390
391
                }
789
790
        return 0;
790
791
}
791
792
 
 
793
/*
 
794
 * __open_device: Returns @td corresponding to device with id @dev,
 
795
 * creating it if @create is set and incrementing @td->open_count.
 
796
 * On failure, @td is undefined.
 
797
 */
792
798
static int __open_device(struct dm_pool_metadata *pmd,
793
799
                         dm_thin_id dev, int create,
794
800
                         struct dm_thin_device **td)
799
805
        struct disk_device_details details_le;
800
806
 
801
807
        /*
802
 
         * Check the device isn't already open.
 
808
         * If the device is already open, return it.
803
809
         */
804
810
        list_for_each_entry(td2, &pmd->thin_devices, list)
805
811
                if (td2->id == dev) {
 
812
                        /*
 
813
                         * May not create an already-open device.
 
814
                         */
 
815
                        if (create)
 
816
                                return -EEXIST;
 
817
 
806
818
                        td2->open_count++;
807
819
                        *td = td2;
808
820
                        return 0;
817
829
                if (r != -ENODATA || !create)
818
830
                        return r;
819
831
 
 
832
                /*
 
833
                 * Create new device.
 
834
                 */
820
835
                changed = 1;
821
836
                details_le.mapped_blocks = 0;
822
837
                details_le.transaction_id = cpu_to_le64(pmd->trans_id);
882
897
 
883
898
        r = __open_device(pmd, dev, 1, &td);
884
899
        if (r) {
885
 
                __close_device(td);
886
900
                dm_btree_remove(&pmd->tl_info, pmd->root, &key, &pmd->root);
887
901
                dm_btree_del(&pmd->bl_info, dev_root);
888
902
                return r;
889
903
        }
890
 
        td->changed = 1;
891
904
        __close_device(td);
892
905
 
893
906
        return r;
967
980
                goto bad;
968
981
 
969
982
        r = __set_snapshot_details(pmd, td, origin, pmd->time);
 
983
        __close_device(td);
 
984
 
970
985
        if (r)
971
986
                goto bad;
972
987
 
973
 
        __close_device(td);
974
988
        return 0;
975
989
 
976
990
bad:
977
 
        __close_device(td);
978
991
        dm_btree_remove(&pmd->tl_info, pmd->root, &key, &pmd->root);
979
992
        dm_btree_remove(&pmd->details_info, pmd->details_root,
980
993
                        &key, &pmd->details_root);
1211
1224
        if (r)
1212
1225
                return r;
1213
1226
 
 
1227
        td->mapped_blocks--;
 
1228
        td->changed = 1;
1214
1229
        pmd->need_commit = 1;
1215
1230
 
1216
1231
        return 0;