Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'ap-driver-override' into features

Harald Freudenberger says:

====================

Support for driver override on AP queues.

Add a new sysfs attribute driver_override the AP queue's directory. Writing
in a string overrides the default driver determination and the drivers are
matched against this string instead. This overrules the driver binding
determined by the apmask/aqmask bitmask fields. With the write to the
attribute a check is done if the queue is in use by an mdev device.
If this is true, the write is aborted and EBUSY is returned.

As there exists some tooling for this kind of driver_override
(see package driverctl) the AP bus behavior for re-binding
should be compatible to this. The steps for a driver_override are:
1) unbind the current driver from the device. For example
echo "17.0005" > /sys/devices/ap/card17/17.0005/driver/unbind
2) set the new driver for this device in the sysfs
driver_override attribute. For example
echo "vfio_ap" > /sys//devices/ap/card17/17.0005/driver_override
3) trigger a bus reprobe of this device. For example
echo "17.0005" > /sys/bus/ap/drivers_probe
With the driverctl package this is more comfortable and
the settings get persisted:
driverctl -b ap set-override 17.0005 vfio_ap
and unset with
driverctl -b ap unset-override 17.0005

====================

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

+216 -75
+130 -45
drivers/s390/crypto/ap_bus.c
··· 86 86 /* Default permissions (ioctl, card and domain masking) */ 87 87 struct ap_perms ap_perms; 88 88 EXPORT_SYMBOL(ap_perms); 89 - DEFINE_MUTEX(ap_perms_mutex); 90 - EXPORT_SYMBOL(ap_perms_mutex); 89 + /* true if apmask and/or aqmask are NOT default */ 90 + bool ap_apmask_aqmask_in_use; 91 + /* counter for how many driver_overrides are currently active */ 92 + int ap_driver_override_ctr; 93 + /* 94 + * Mutex for consistent read and write of the ap_perms struct, 95 + * ap_apmask_aqmask_in_use, ap_driver_override_ctr 96 + * and the ap bus sysfs attributes apmask and aqmask. 97 + */ 98 + DEFINE_MUTEX(ap_attr_mutex); 99 + EXPORT_SYMBOL(ap_attr_mutex); 91 100 92 101 /* # of bindings complete since init */ 93 102 static atomic64_t ap_bindings_complete_count = ATOMIC64_INIT(0); ··· 862 853 int rc, card, queue, devres, drvres; 863 854 864 855 if (is_queue_dev(dev)) { 865 - card = AP_QID_CARD(to_ap_queue(dev)->qid); 866 - queue = AP_QID_QUEUE(to_ap_queue(dev)->qid); 867 - mutex_lock(&ap_perms_mutex); 868 - devres = test_bit_inv(card, ap_perms.apm) && 869 - test_bit_inv(queue, ap_perms.aqm); 870 - mutex_unlock(&ap_perms_mutex); 871 - drvres = to_ap_drv(dev->driver)->flags 872 - & AP_DRIVER_FLAG_DEFAULT; 873 - if (!!devres != !!drvres) { 874 - pr_debug("reprobing queue=%02x.%04x\n", card, queue); 875 - rc = device_reprobe(dev); 876 - if (rc) 877 - AP_DBF_WARN("%s reprobing queue=%02x.%04x failed\n", 878 - __func__, card, queue); 856 + struct ap_driver *ap_drv = to_ap_drv(dev->driver); 857 + struct ap_queue *aq = to_ap_queue(dev); 858 + struct ap_device *ap_dev = &aq->ap_dev; 859 + 860 + card = AP_QID_CARD(aq->qid); 861 + queue = AP_QID_QUEUE(aq->qid); 862 + 863 + if (ap_dev->driver_override) { 864 + if (strcmp(ap_dev->driver_override, 865 + ap_drv->driver.name)) { 866 + pr_debug("reprobing queue=%02x.%04x\n", card, queue); 867 + rc = device_reprobe(dev); 868 + if (rc) { 869 + AP_DBF_WARN("%s reprobing queue=%02x.%04x failed\n", 870 + __func__, card, queue); 871 + } 872 + } 873 + } else { 874 + mutex_lock(&ap_attr_mutex); 875 + devres = test_bit_inv(card, ap_perms.apm) && 876 + test_bit_inv(queue, ap_perms.aqm); 877 + mutex_unlock(&ap_attr_mutex); 878 + drvres = to_ap_drv(dev->driver)->flags 879 + & AP_DRIVER_FLAG_DEFAULT; 880 + if (!!devres != !!drvres) { 881 + pr_debug("reprobing queue=%02x.%04x\n", card, queue); 882 + rc = device_reprobe(dev); 883 + if (rc) { 884 + AP_DBF_WARN("%s reprobing queue=%02x.%04x failed\n", 885 + __func__, card, queue); 886 + } 887 + } 879 888 } 880 889 } 881 890 ··· 911 884 * @card: the APID of the adapter card to check 912 885 * @queue: the APQI of the queue to check 913 886 * 914 - * Note: the ap_perms_mutex must be locked by the caller of this function. 887 + * Note: the ap_attr_mutex must be locked by the caller of this function. 915 888 * 916 889 * Return: an int specifying whether the AP adapter is reserved for the host (1) 917 890 * or not (0). 918 891 */ 919 892 int ap_owned_by_def_drv(int card, int queue) 920 893 { 894 + struct ap_queue *aq; 921 895 int rc = 0; 922 896 923 897 if (card < 0 || card >= AP_DEVICES || queue < 0 || queue >= AP_DOMAINS) 924 898 return -EINVAL; 925 899 900 + aq = ap_get_qdev(AP_MKQID(card, queue)); 901 + if (aq) { 902 + const struct device_driver *drv = aq->ap_dev.device.driver; 903 + const struct ap_driver *ap_drv = to_ap_drv(drv); 904 + bool override = !!aq->ap_dev.driver_override; 905 + 906 + if (override && drv && ap_drv->flags & AP_DRIVER_FLAG_DEFAULT) 907 + rc = 1; 908 + put_device(&aq->ap_dev.device); 909 + if (override) 910 + goto out; 911 + } 912 + 926 913 if (test_bit_inv(card, ap_perms.apm) && 927 914 test_bit_inv(queue, ap_perms.aqm)) 928 915 rc = 1; 929 916 917 + out: 930 918 return rc; 931 919 } 932 920 EXPORT_SYMBOL(ap_owned_by_def_drv); ··· 953 911 * @apm: a bitmap specifying a set of APIDs comprising the APQNs to check 954 912 * @aqm: a bitmap specifying a set of APQIs comprising the APQNs to check 955 913 * 956 - * Note: the ap_perms_mutex must be locked by the caller of this function. 914 + * Note: the ap_attr_mutex must be locked by the caller of this function. 957 915 * 958 916 * Return: an int specifying whether each APQN is reserved for the host (1) or 959 917 * not (0) ··· 964 922 int card, queue, rc = 0; 965 923 966 924 for (card = 0; !rc && card < AP_DEVICES; card++) 967 - if (test_bit_inv(card, apm) && 968 - test_bit_inv(card, ap_perms.apm)) 925 + if (test_bit_inv(card, apm)) 969 926 for (queue = 0; !rc && queue < AP_DOMAINS; queue++) 970 - if (test_bit_inv(queue, aqm) && 971 - test_bit_inv(queue, ap_perms.aqm)) 972 - rc = 1; 927 + if (test_bit_inv(queue, aqm)) 928 + rc = ap_owned_by_def_drv(card, queue); 973 929 974 930 return rc; 975 931 } ··· 991 951 */ 992 952 card = AP_QID_CARD(to_ap_queue(dev)->qid); 993 953 queue = AP_QID_QUEUE(to_ap_queue(dev)->qid); 994 - mutex_lock(&ap_perms_mutex); 995 - devres = test_bit_inv(card, ap_perms.apm) && 996 - test_bit_inv(queue, ap_perms.aqm); 997 - mutex_unlock(&ap_perms_mutex); 998 - drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT; 999 - if (!!devres != !!drvres) 1000 - goto out; 954 + if (ap_dev->driver_override) { 955 + if (strcmp(ap_dev->driver_override, 956 + ap_drv->driver.name)) 957 + goto out; 958 + } else { 959 + mutex_lock(&ap_attr_mutex); 960 + devres = test_bit_inv(card, ap_perms.apm) && 961 + test_bit_inv(queue, ap_perms.aqm); 962 + mutex_unlock(&ap_attr_mutex); 963 + drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT; 964 + if (!!devres != !!drvres) 965 + goto out; 966 + } 1001 967 } 1002 968 1003 969 /* ··· 1029 983 } 1030 984 1031 985 out: 1032 - if (rc) 986 + if (rc) { 1033 987 put_device(dev); 988 + } else { 989 + if (is_queue_dev(dev)) { 990 + pr_debug("queue=%02x.%04x new driver=%s\n", 991 + card, queue, ap_drv->driver.name); 992 + } else { 993 + pr_debug("card=%02x new driver=%s\n", 994 + to_ap_card(dev)->id, ap_drv->driver.name); 995 + } 996 + } 1034 997 return rc; 1035 998 } 1036 999 ··· 1492 1437 { 1493 1438 int rc; 1494 1439 1495 - if (mutex_lock_interruptible(&ap_perms_mutex)) 1440 + if (mutex_lock_interruptible(&ap_attr_mutex)) 1496 1441 return -ERESTARTSYS; 1497 1442 rc = sysfs_emit(buf, "0x%016lx%016lx%016lx%016lx\n", 1498 1443 ap_perms.apm[0], ap_perms.apm[1], 1499 1444 ap_perms.apm[2], ap_perms.apm[3]); 1500 - mutex_unlock(&ap_perms_mutex); 1445 + mutex_unlock(&ap_attr_mutex); 1501 1446 1502 1447 return rc; 1503 1448 } ··· 1507 1452 int rc = 0; 1508 1453 struct ap_driver *ap_drv = to_ap_drv(drv); 1509 1454 unsigned long *newapm = (unsigned long *)data; 1455 + unsigned long aqm_any[BITS_TO_LONGS(AP_DOMAINS)]; 1510 1456 1511 1457 /* 1512 1458 * increase the driver's module refcounter to be sure it is not ··· 1517 1461 return 0; 1518 1462 1519 1463 if (ap_drv->in_use) { 1520 - rc = ap_drv->in_use(newapm, ap_perms.aqm); 1464 + bitmap_fill(aqm_any, AP_DOMAINS); 1465 + rc = ap_drv->in_use(newapm, aqm_any); 1521 1466 if (rc) 1522 1467 rc = -EBUSY; 1523 1468 } ··· 1547 1490 1548 1491 memcpy(ap_perms.apm, newapm, APMASKSIZE); 1549 1492 1493 + /* 1494 + * Update ap_apmask_aqmask_in_use. Note that the 1495 + * ap_attr_mutex has to be obtained here. 1496 + */ 1497 + ap_apmask_aqmask_in_use = 1498 + bitmap_full(ap_perms.apm, AP_DEVICES) && 1499 + bitmap_full(ap_perms.aqm, AP_DOMAINS) ? 1500 + false : true; 1501 + 1550 1502 return 0; 1551 1503 } 1552 1504 1553 1505 static ssize_t apmask_store(const struct bus_type *bus, const char *buf, 1554 1506 size_t count) 1555 1507 { 1556 - int rc, changes = 0; 1557 1508 DECLARE_BITMAP(newapm, AP_DEVICES); 1509 + int rc = -EINVAL, changes = 0; 1558 1510 1559 - if (mutex_lock_interruptible(&ap_perms_mutex)) 1511 + if (mutex_lock_interruptible(&ap_attr_mutex)) 1560 1512 return -ERESTARTSYS; 1513 + 1514 + /* Do not allow apmask/aqmask if driver override is active */ 1515 + if (ap_driver_override_ctr) 1516 + goto done; 1561 1517 1562 1518 rc = ap_parse_bitmap_str(buf, ap_perms.apm, AP_DEVICES, newapm); 1563 1519 if (rc) ··· 1581 1511 rc = apmask_commit(newapm); 1582 1512 1583 1513 done: 1584 - mutex_unlock(&ap_perms_mutex); 1514 + mutex_unlock(&ap_attr_mutex); 1585 1515 if (rc) 1586 1516 return rc; 1587 1517 ··· 1599 1529 { 1600 1530 int rc; 1601 1531 1602 - if (mutex_lock_interruptible(&ap_perms_mutex)) 1532 + if (mutex_lock_interruptible(&ap_attr_mutex)) 1603 1533 return -ERESTARTSYS; 1604 1534 rc = sysfs_emit(buf, "0x%016lx%016lx%016lx%016lx\n", 1605 1535 ap_perms.aqm[0], ap_perms.aqm[1], 1606 1536 ap_perms.aqm[2], ap_perms.aqm[3]); 1607 - mutex_unlock(&ap_perms_mutex); 1537 + mutex_unlock(&ap_attr_mutex); 1608 1538 1609 1539 return rc; 1610 1540 } ··· 1614 1544 int rc = 0; 1615 1545 struct ap_driver *ap_drv = to_ap_drv(drv); 1616 1546 unsigned long *newaqm = (unsigned long *)data; 1547 + unsigned long apm_any[BITS_TO_LONGS(AP_DEVICES)]; 1617 1548 1618 1549 /* 1619 1550 * increase the driver's module refcounter to be sure it is not ··· 1624 1553 return 0; 1625 1554 1626 1555 if (ap_drv->in_use) { 1627 - rc = ap_drv->in_use(ap_perms.apm, newaqm); 1556 + bitmap_fill(apm_any, AP_DEVICES); 1557 + rc = ap_drv->in_use(apm_any, newaqm); 1628 1558 if (rc) 1629 1559 rc = -EBUSY; 1630 1560 } ··· 1654 1582 1655 1583 memcpy(ap_perms.aqm, newaqm, AQMASKSIZE); 1656 1584 1585 + /* 1586 + * Update ap_apmask_aqmask_in_use. Note that the 1587 + * ap_attr_mutex has to be obtained here. 1588 + */ 1589 + ap_apmask_aqmask_in_use = 1590 + bitmap_full(ap_perms.apm, AP_DEVICES) && 1591 + bitmap_full(ap_perms.aqm, AP_DOMAINS) ? 1592 + false : true; 1593 + 1657 1594 return 0; 1658 1595 } 1659 1596 1660 1597 static ssize_t aqmask_store(const struct bus_type *bus, const char *buf, 1661 1598 size_t count) 1662 1599 { 1663 - int rc, changes = 0; 1664 1600 DECLARE_BITMAP(newaqm, AP_DOMAINS); 1601 + int rc = -EINVAL, changes = 0; 1665 1602 1666 - if (mutex_lock_interruptible(&ap_perms_mutex)) 1603 + if (mutex_lock_interruptible(&ap_attr_mutex)) 1667 1604 return -ERESTARTSYS; 1605 + 1606 + /* Do not allow apmask/aqmask if driver override is active */ 1607 + if (ap_driver_override_ctr) 1608 + goto done; 1668 1609 1669 1610 rc = ap_parse_bitmap_str(buf, ap_perms.aqm, AP_DOMAINS, newaqm); 1670 1611 if (rc) ··· 1688 1603 rc = aqmask_commit(newaqm); 1689 1604 1690 1605 done: 1691 - mutex_unlock(&ap_perms_mutex); 1606 + mutex_unlock(&ap_attr_mutex); 1692 1607 if (rc) 1693 1608 return rc; 1694 1609 ··· 2559 2474 if (apm_str) { 2560 2475 memset(&ap_perms.apm, 0, sizeof(ap_perms.apm)); 2561 2476 ap_parse_mask_str(apm_str, ap_perms.apm, AP_DEVICES, 2562 - &ap_perms_mutex); 2477 + &ap_attr_mutex); 2563 2478 } 2564 2479 2565 2480 /* aqm kernel parameter string */ 2566 2481 if (aqm_str) { 2567 2482 memset(&ap_perms.aqm, 0, sizeof(ap_perms.aqm)); 2568 2483 ap_parse_mask_str(aqm_str, ap_perms.aqm, AP_DOMAINS, 2569 - &ap_perms_mutex); 2484 + &ap_attr_mutex); 2570 2485 } 2571 2486 } 2572 2487
+4 -1
drivers/s390/crypto/ap_bus.h
··· 166 166 struct ap_device { 167 167 struct device device; 168 168 int device_type; /* AP device type. */ 169 + const char *driver_override; 169 170 }; 170 171 171 172 #define to_ap_dev(x) container_of((x), struct ap_device, device) ··· 281 280 }; 282 281 283 282 extern struct ap_perms ap_perms; 284 - extern struct mutex ap_perms_mutex; 283 + extern bool ap_apmask_aqmask_in_use; 284 + extern int ap_driver_override_ctr; 285 + extern struct mutex ap_attr_mutex; 285 286 286 287 /* 287 288 * Get ap_queue device for this qid.
+53
drivers/s390/crypto/ap_queue.c
··· 731 731 732 732 static DEVICE_ATTR_RO(ap_functions); 733 733 734 + static ssize_t driver_override_show(struct device *dev, 735 + struct device_attribute *attr, 736 + char *buf) 737 + { 738 + struct ap_queue *aq = to_ap_queue(dev); 739 + struct ap_device *ap_dev = &aq->ap_dev; 740 + int rc; 741 + 742 + device_lock(dev); 743 + if (ap_dev->driver_override) 744 + rc = sysfs_emit(buf, "%s\n", ap_dev->driver_override); 745 + else 746 + rc = sysfs_emit(buf, "\n"); 747 + device_unlock(dev); 748 + 749 + return rc; 750 + } 751 + 752 + static ssize_t driver_override_store(struct device *dev, 753 + struct device_attribute *attr, 754 + const char *buf, size_t count) 755 + { 756 + struct ap_queue *aq = to_ap_queue(dev); 757 + struct ap_device *ap_dev = &aq->ap_dev; 758 + int rc = -EINVAL; 759 + bool old_value; 760 + 761 + if (mutex_lock_interruptible(&ap_attr_mutex)) 762 + return -ERESTARTSYS; 763 + 764 + /* Do not allow driver override if apmask/aqmask is in use */ 765 + if (ap_apmask_aqmask_in_use) 766 + goto out; 767 + 768 + old_value = ap_dev->driver_override ? true : false; 769 + rc = driver_set_override(dev, &ap_dev->driver_override, buf, count); 770 + if (rc) 771 + goto out; 772 + if (old_value && !ap_dev->driver_override) 773 + --ap_driver_override_ctr; 774 + else if (!old_value && ap_dev->driver_override) 775 + ++ap_driver_override_ctr; 776 + 777 + rc = count; 778 + 779 + out: 780 + mutex_unlock(&ap_attr_mutex); 781 + return rc; 782 + } 783 + 784 + static DEVICE_ATTR_RW(driver_override); 785 + 734 786 #ifdef CONFIG_AP_DEBUG 735 787 static ssize_t states_show(struct device *dev, 736 788 struct device_attribute *attr, char *buf) ··· 895 843 &dev_attr_config.attr, 896 844 &dev_attr_chkstop.attr, 897 845 &dev_attr_ap_functions.attr, 846 + &dev_attr_driver_override.attr, 898 847 #ifdef CONFIG_AP_DEBUG 899 848 &dev_attr_states.attr, 900 849 &dev_attr_last_err_rc.attr,
+7 -7
drivers/s390/crypto/vfio_ap_ops.c
··· 968 968 * 969 969 * Return: One of the following values: 970 970 * o the error returned from the ap_apqn_in_matrix_owned_by_def_drv() function, 971 - * most likely -EBUSY indicating the ap_perms_mutex lock is already held. 971 + * most likely -EBUSY indicating the ap_attr_mutex lock is already held. 972 972 * o EADDRNOTAVAIL if an APQN assigned to @matrix_mdev is reserved for the 973 973 * zcrypt default driver. 974 974 * o EADDRINUSE if an APQN assigned to @matrix_mdev is assigned to another mdev ··· 1079 1079 DECLARE_BITMAP(apm_filtered, AP_DEVICES); 1080 1080 struct ap_matrix_mdev *matrix_mdev = dev_get_drvdata(dev); 1081 1081 1082 - mutex_lock(&ap_perms_mutex); 1082 + mutex_lock(&ap_attr_mutex); 1083 1083 get_update_locks_for_mdev(matrix_mdev); 1084 1084 1085 1085 ret = kstrtoul(buf, 0, &apid); ··· 1114 1114 ret = count; 1115 1115 done: 1116 1116 release_update_locks_for_mdev(matrix_mdev); 1117 - mutex_unlock(&ap_perms_mutex); 1117 + mutex_unlock(&ap_attr_mutex); 1118 1118 1119 1119 return ret; 1120 1120 } ··· 1303 1303 DECLARE_BITMAP(apm_filtered, AP_DEVICES); 1304 1304 struct ap_matrix_mdev *matrix_mdev = dev_get_drvdata(dev); 1305 1305 1306 - mutex_lock(&ap_perms_mutex); 1306 + mutex_lock(&ap_attr_mutex); 1307 1307 get_update_locks_for_mdev(matrix_mdev); 1308 1308 1309 1309 ret = kstrtoul(buf, 0, &apqi); ··· 1338 1338 ret = count; 1339 1339 done: 1340 1340 release_update_locks_for_mdev(matrix_mdev); 1341 - mutex_unlock(&ap_perms_mutex); 1341 + mutex_unlock(&ap_attr_mutex); 1342 1342 1343 1343 return ret; 1344 1344 } ··· 1718 1718 return -ENOMEM; 1719 1719 rest = newbuf; 1720 1720 1721 - mutex_lock(&ap_perms_mutex); 1721 + mutex_lock(&ap_attr_mutex); 1722 1722 get_update_locks_for_mdev(matrix_mdev); 1723 1723 1724 1724 /* Save old state */ ··· 1779 1779 } 1780 1780 out: 1781 1781 release_update_locks_for_mdev(matrix_mdev); 1782 - mutex_unlock(&ap_perms_mutex); 1782 + mutex_unlock(&ap_attr_mutex); 1783 1783 kfree(newbuf); 1784 1784 return rc; 1785 1785 }
+22 -22
drivers/s390/crypto/zcrypt_api.c
··· 162 162 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 163 163 int i, n; 164 164 165 - if (mutex_lock_interruptible(&ap_perms_mutex)) 165 + if (mutex_lock_interruptible(&ap_attr_mutex)) 166 166 return -ERESTARTSYS; 167 167 168 168 n = sysfs_emit(buf, "0x"); ··· 170 170 n += sysfs_emit_at(buf, n, "%016lx", zcdndev->perms.ioctlm[i]); 171 171 n += sysfs_emit_at(buf, n, "\n"); 172 172 173 - mutex_unlock(&ap_perms_mutex); 173 + mutex_unlock(&ap_attr_mutex); 174 174 175 175 return n; 176 176 } ··· 183 183 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 184 184 185 185 rc = ap_parse_mask_str(buf, zcdndev->perms.ioctlm, 186 - AP_IOCTLS, &ap_perms_mutex); 186 + AP_IOCTLS, &ap_attr_mutex); 187 187 if (rc) 188 188 return rc; 189 189 ··· 199 199 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 200 200 int i, n; 201 201 202 - if (mutex_lock_interruptible(&ap_perms_mutex)) 202 + if (mutex_lock_interruptible(&ap_attr_mutex)) 203 203 return -ERESTARTSYS; 204 204 205 205 n = sysfs_emit(buf, "0x"); ··· 207 207 n += sysfs_emit_at(buf, n, "%016lx", zcdndev->perms.apm[i]); 208 208 n += sysfs_emit_at(buf, n, "\n"); 209 209 210 - mutex_unlock(&ap_perms_mutex); 210 + mutex_unlock(&ap_attr_mutex); 211 211 212 212 return n; 213 213 } ··· 220 220 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 221 221 222 222 rc = ap_parse_mask_str(buf, zcdndev->perms.apm, 223 - AP_DEVICES, &ap_perms_mutex); 223 + AP_DEVICES, &ap_attr_mutex); 224 224 if (rc) 225 225 return rc; 226 226 ··· 236 236 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 237 237 int i, n; 238 238 239 - if (mutex_lock_interruptible(&ap_perms_mutex)) 239 + if (mutex_lock_interruptible(&ap_attr_mutex)) 240 240 return -ERESTARTSYS; 241 241 242 242 n = sysfs_emit(buf, "0x"); ··· 244 244 n += sysfs_emit_at(buf, n, "%016lx", zcdndev->perms.aqm[i]); 245 245 n += sysfs_emit_at(buf, n, "\n"); 246 246 247 - mutex_unlock(&ap_perms_mutex); 247 + mutex_unlock(&ap_attr_mutex); 248 248 249 249 return n; 250 250 } ··· 257 257 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 258 258 259 259 rc = ap_parse_mask_str(buf, zcdndev->perms.aqm, 260 - AP_DOMAINS, &ap_perms_mutex); 260 + AP_DOMAINS, &ap_attr_mutex); 261 261 if (rc) 262 262 return rc; 263 263 ··· 273 273 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 274 274 int i, n; 275 275 276 - if (mutex_lock_interruptible(&ap_perms_mutex)) 276 + if (mutex_lock_interruptible(&ap_attr_mutex)) 277 277 return -ERESTARTSYS; 278 278 279 279 n = sysfs_emit(buf, "0x"); ··· 281 281 n += sysfs_emit_at(buf, n, "%016lx", zcdndev->perms.adm[i]); 282 282 n += sysfs_emit_at(buf, n, "\n"); 283 283 284 - mutex_unlock(&ap_perms_mutex); 284 + mutex_unlock(&ap_attr_mutex); 285 285 286 286 return n; 287 287 } ··· 294 294 struct zcdn_device *zcdndev = to_zcdn_dev(dev); 295 295 296 296 rc = ap_parse_mask_str(buf, zcdndev->perms.adm, 297 - AP_DOMAINS, &ap_perms_mutex); 297 + AP_DOMAINS, &ap_attr_mutex); 298 298 if (rc) 299 299 return rc; 300 300 ··· 370 370 int i, rc = 0; 371 371 struct zcdn_device *zcdndev; 372 372 373 - if (mutex_lock_interruptible(&ap_perms_mutex)) 373 + if (mutex_lock_interruptible(&ap_attr_mutex)) 374 374 return -ERESTARTSYS; 375 375 376 376 /* check if device node with this name already exists */ ··· 425 425 __func__, MAJOR(devt), MINOR(devt)); 426 426 427 427 unlockout: 428 - mutex_unlock(&ap_perms_mutex); 428 + mutex_unlock(&ap_attr_mutex); 429 429 return rc; 430 430 } 431 431 ··· 434 434 int rc = 0; 435 435 struct zcdn_device *zcdndev; 436 436 437 - if (mutex_lock_interruptible(&ap_perms_mutex)) 437 + if (mutex_lock_interruptible(&ap_attr_mutex)) 438 438 return -ERESTARTSYS; 439 439 440 440 /* try to find this zcdn device */ ··· 452 452 device_unregister(&zcdndev->device); 453 453 454 454 unlockout: 455 - mutex_unlock(&ap_perms_mutex); 455 + mutex_unlock(&ap_attr_mutex); 456 456 return rc; 457 457 } 458 458 ··· 462 462 dev_t devt; 463 463 struct zcdn_device *zcdndev; 464 464 465 - mutex_lock(&ap_perms_mutex); 465 + mutex_lock(&ap_attr_mutex); 466 466 for (i = 0; i < ZCRYPT_MAX_MINOR_NODES; i++) { 467 467 devt = MKDEV(MAJOR(zcrypt_devt), MINOR(zcrypt_devt) + i); 468 468 zcdndev = find_zcdndev_by_devt(devt); ··· 471 471 device_unregister(&zcdndev->device); 472 472 } 473 473 } 474 - mutex_unlock(&ap_perms_mutex); 474 + mutex_unlock(&ap_attr_mutex); 475 475 } 476 476 477 477 /* ··· 508 508 if (filp->f_inode->i_cdev == &zcrypt_cdev) { 509 509 struct zcdn_device *zcdndev; 510 510 511 - if (mutex_lock_interruptible(&ap_perms_mutex)) 511 + if (mutex_lock_interruptible(&ap_attr_mutex)) 512 512 return -ERESTARTSYS; 513 513 zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev); 514 514 /* find returns a reference, no get_device() needed */ 515 - mutex_unlock(&ap_perms_mutex); 515 + mutex_unlock(&ap_attr_mutex); 516 516 if (zcdndev) 517 517 perms = &zcdndev->perms; 518 518 } ··· 532 532 if (filp->f_inode->i_cdev == &zcrypt_cdev) { 533 533 struct zcdn_device *zcdndev; 534 534 535 - mutex_lock(&ap_perms_mutex); 535 + mutex_lock(&ap_attr_mutex); 536 536 zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev); 537 - mutex_unlock(&ap_perms_mutex); 537 + mutex_unlock(&ap_attr_mutex); 538 538 if (zcdndev) { 539 539 /* 2 puts here: one for find, one for open */ 540 540 put_device(&zcdndev->device);