Merge ~ahasenack/ubuntu/+source/samba:groovy-samba-uring into ubuntu/+source/samba:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: Andreas Hasenack
Approved revision: bf2783b307b4ff5b14e9acc995b8c71aef629872
Merged at revision: bf2783b307b4ff5b14e9acc995b8c71aef629872
Proposed branch: ~ahasenack/ubuntu/+source/samba:groovy-samba-uring
Merge into: ubuntu/+source/samba:ubuntu/devel
Diff against target: 340 lines (+180/-56)
10 files modified
debian/changelog (+20/-0)
debian/control (+1/-0)
debian/tests/cifs-share-access (+13/-24)
debian/tests/cifs-share-access-uring (+35/-0)
debian/tests/control (+8/-0)
debian/tests/smbclient-anonymous-share-list (+4/-1)
debian/tests/smbclient-authenticated-share-list (+9/-8)
debian/tests/smbclient-share-access (+12/-23)
debian/tests/smbclient-share-access-uring (+29/-0)
debian/tests/util (+49/-0)
Reviewer Review Type Date Requested Status
Lucas Kanashiro (community) Approve
Canonical Server Core Reviewers Pending
Review via email: mp+388683@code.launchpad.net

Description of the change

Enable uring support in samba. This builds a new vfs module, which can then optionally be enabled.

uring support first appeared in version 4.12.0. Search for "io_uring": https://www.samba.org/samba/history/samba-4.12.0.html

I also added DEP8 tests for it, basically the same tests we already had, but now on a share with this vfs module loaded. I took the opportunity to refactor these tests a bit, to avoid duplication of code. I kept the commits separate to make it easier to submit them to debian: a) the refactor; b) the new uring changes

If you are happy with these, I will then submit to debian before uploading.

Bileto, still running: https://bileto.ubuntu.com/#/ticket/4179

I did run the tests locally before, both in a VM and in LXD, and with proposed enabled, so I don't expect trouble. Bileto is slow because of the risc64 build.

To post a comment you must log in.
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

I am going to review this MP.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Forgot to add skippable to the uring test restriction. Committed, force-pushed.

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

I added an inline comment to suggest a refactoring change.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I pushed new commits with that extra refactoring, and am waiting for the ppa to build now (due to risc64 bileto tickets are sloooooooooooooooooooooooooooooooooooooooooooooooooow)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Bileto is mostly done again, and green-ish (the usual i386 and gfvs)

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

* Changelog:
  - [ ] old content and logical tag match as expected
  - [ ] changelog entry correct version and targeted codename
  - [ ] changelog entries correct
  - [ ] update-maintainer has been run

* Actual changes:
  - [ ] no upstream changes to consider
  - [ ] no further upstream version to consider
  - [ ] debian changes look safe

* Old Delta:
  - [-] dropped changes are ok to be dropped
  - [√] nothing else to drop
  - [-] changes forwarded upstream/debian (if appropriate)

* New Delta:
  - [√] no new patches added
  - [-] patches match what was proposed upstream
  - [-] patches correctly included in debian/patches/series
  - [-] patches have correct DEP3 metadata

* Build/Test:
  - [√] build is ok
  - [√] verified PPA package installs/uninstalls
  - [√] autopkgtest against the PPA package passes
  - [√] sanity checks test fine

LGTM, +1.

Thanks for implementing my suggestion Andreas. I believe it's ready to be submitted to Debian and uploaded to Ubuntu in the meantime.

review: Approve
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Sorry, forgot to fill all the fields in my checklist but it's all right :)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks, tagging and uploading bf2783b307b4ff5b14e9acc995b8c71aef629872

$ git push pkg upload/2%4.12.5+dfsg-3ubuntu2
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 4 threads
Compressing objects: 100% (23/23), done.
Writing objects: 100% (29/29), 4.50 KiB | 1.12 MiB/s, done.
Total 29 (delta 18), reused 14 (delta 6)
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/samba
 * [new tag] upload/2%4.12.5+dfsg-3ubuntu2 -> upload/2%4.12.5+dfsg-3ubuntu2

$ dput ubuntu ../samba_4.12.5+dfsg-3ubuntu2_source.changes
Checking signature on .changes
gpg: ../samba_4.12.5+dfsg-3ubuntu2_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../samba_4.12.5+dfsg-3ubuntu2.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading samba_4.12.5+dfsg-3ubuntu2.dsc: done.
  Uploading samba_4.12.5+dfsg-3ubuntu2.debian.tar.xz: done.
  Uploading samba_4.12.5+dfsg-3ubuntu2_source.buildinfo: done.
  Uploading samba_4.12.5+dfsg-3ubuntu2_source.changes: done.
Successfully uploaded packages.

I'll propose to debian after it migates

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 019552e..406edda 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,23 @@
1samba (2:4.12.5+dfsg-3ubuntu2) groovy; urgency=medium
2
3 * d/t/smbclient-anonymous-share-list: add set -x and set -e
4 * Factor out common DEP8 test code into d/t/util and change the tests
5 to source from it:
6 - d/t/util: added
7 - d/t/cifs-share-access, d/t/smbclient-share-access: source from
8 util, use random share name and add set -x and set -u
9 - d/t/smbclient-authenticated-share-list: source from util and add
10 set -x and set -u
11 * d/control: enable the liburing vfs module, except on i386 where
12 liburing is not available
13 * Add new DEP8 tests for the uring vfs module:
14 - d/t/control: add smbclient-share-access-uring and
15 cifs-share-access-uring tests
16 - d/t/smbclient-share-access-uring: new test
17 - d/t/cifs-share-access-uring: new test
18
19 -- Andreas Hasenack <andreas@canonical.com> Tue, 04 Aug 2020 17:20:30 -0300
20
1samba (2:4.12.5+dfsg-3ubuntu1) groovy; urgency=medium21samba (2:4.12.5+dfsg-3ubuntu1) groovy; urgency=medium
222
3 * Merge with Debian unstable. Remaining changes:23 * Merge with Debian unstable. Remaining changes:
diff --git a/debian/control b/debian/control
index 790dc6a..088a9bb 100644
--- a/debian/control
+++ b/debian/control
@@ -45,6 +45,7 @@ Build-Depends: bison,
45 libtasn1-bin,45 libtasn1-bin,
46 libtdb-dev (>= 1.4.3~),46 libtdb-dev (>= 1.4.3~),
47 libtevent-dev (>= 0.10.2~),47 libtevent-dev (>= 0.10.2~),
48 liburing-dev [!i386],
48 perl,49 perl,
49 pkg-config,50 pkg-config,
50 po-debconf,51 po-debconf,
diff --git a/debian/tests/cifs-share-access b/debian/tests/cifs-share-access
index acfb70a..47ce01a 100644
--- a/debian/tests/cifs-share-access
+++ b/debian/tests/cifs-share-access
@@ -1,34 +1,23 @@
1#!/bin/sh -x1#!/bin/sh
22
3if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then3set -x
4 echo "Adding [homes] share"4set -e
5 cat >> /etc/samba/smb.conf <<EOFEOF5
6[homes]6. debian/tests/util
7 valid users = %S
8 read only = no
9 guest ok = no
10EOFEOF
11 systemctl reload smbd.service
12else
13 echo "No need to add [homes] share, continuing."
14fi
157
16username="smbtest$$"8username="smbtest$$"
17password="$$"9password="$$"
18echo "Creating a local test user called ${username}"10add_user "${username}" "${password}"
19useradd -m "$username"11
20echo "Setting samba password for the ${username} user"12myshare="myshare$$"
21echo "${password}\n${password}" | smbpasswd -s -a ${username}13add_share "${myshare}"
22userhome=$(eval echo ~$username)14
23echo "Creating file with random data and computing its md5"15echo "Creating file with random data and computing its md5"
24dd if=/dev/urandom bs=1 count=128 2>/dev/null | base64 > ${userhome}/data16populate_share "${myshare}" "${username}"
25chown ${username}:${username} ${userhome}/data
26cd ${userhome}
27md5sum data > data.md5
2817
29echo "Mounting //localhost/${username} via CIFS"18echo "Mounting //localhost/${myshare} via CIFS"
30temp_mount=$(mktemp -d)19temp_mount=$(mktemp -d)
31mount -t cifs //localhost/${username} "$temp_mount" -o user=${username},username=${username},password=${password}20mount -t cifs //localhost/"${myshare}" "$temp_mount" -o user="${username}",username="${username}",password="${password}"
3221
33echo "Verifying MD5 via cifs"22echo "Verifying MD5 via cifs"
34cd "$temp_mount"23cd "$temp_mount"
diff --git a/debian/tests/cifs-share-access-uring b/debian/tests/cifs-share-access-uring
35new file mode 10064424new file mode 100644
index 0000000..6bbd3e1
--- /dev/null
+++ b/debian/tests/cifs-share-access-uring
@@ -0,0 +1,35 @@
1#!/bin/sh
2
3set -x
4set -e
5
6ARCH=$(dpkg --print-architecture)
7if [ "$ARCH" = "i386" ]; then
8 echo "liburing not available on $ARCH, skipping test"
9 exit 77
10fi
11
12. debian/tests/util
13
14username="smbtest$$"
15password="$$"
16add_user "${username}" "${password}"
17
18myshare="myshare$$"
19add_share "${myshare}" io_uring
20
21echo "Creating file with random data and computing its md5"
22populate_share "${myshare}" "${username}"
23
24echo "Mounting //localhost/${myshare} via CIFS"
25temp_mount=$(mktemp -d)
26mount -t cifs //localhost/"${myshare}" "$temp_mount" -o user="${username}",username="${username}",password="${password}"
27
28echo "Verifying MD5 via cifs"
29cd "$temp_mount"
30md5sum -c data.md5
31result=$?
32cd -
33umount "$temp_mount"
34rmdir "$temp_mount"
35exit "$result"
diff --git a/debian/tests/control b/debian/tests/control
index 2ebb31c..3ecb853 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -2,6 +2,10 @@ Tests: cifs-share-access
2Depends: samba, coreutils, systemd, cifs-utils, passwd2Depends: samba, coreutils, systemd, cifs-utils, passwd
3Restrictions: needs-root, allow-stderr, isolation-machine3Restrictions: needs-root, allow-stderr, isolation-machine
44
5Tests: cifs-share-access-uring
6Depends: samba, samba-vfs-modules, coreutils, systemd, cifs-utils, passwd
7Restrictions: needs-root, allow-stderr, isolation-machine, skippable
8
5Tests: python-smoke9Tests: python-smoke
6Depends: python3-samba10Depends: python3-samba
711
@@ -16,3 +20,7 @@ Restrictions: needs-root, allow-stderr, isolation-container
16Tests: smbclient-share-access20Tests: smbclient-share-access
17Depends: samba, smbclient, coreutils, systemd, passwd21Depends: samba, smbclient, coreutils, systemd, passwd
18Restrictions: needs-root, allow-stderr, isolation-container22Restrictions: needs-root, allow-stderr, isolation-container
23
24Tests: smbclient-share-access-uring
25Depends: samba, samba-vfs-modules, smbclient, coreutils, systemd, passwd
26Restrictions: needs-root, allow-stderr, isolation-container, skippable
diff --git a/debian/tests/smbclient-anonymous-share-list b/debian/tests/smbclient-anonymous-share-list
index a503ae7..e71ef27 100644
--- a/debian/tests/smbclient-anonymous-share-list
+++ b/debian/tests/smbclient-anonymous-share-list
@@ -1,3 +1,6 @@
1#!/bin/sh -x1#!/bin/sh
2
3set -x
4set -e
25
3smbclient -N -L localhost6smbclient -N -L localhost
diff --git a/debian/tests/smbclient-authenticated-share-list b/debian/tests/smbclient-authenticated-share-list
index 71f0994..9fcaf43 100644
--- a/debian/tests/smbclient-authenticated-share-list
+++ b/debian/tests/smbclient-authenticated-share-list
@@ -1,17 +1,18 @@
1#!/bin/sh -x1#!/bin/sh
2
3set -x
4set -e
5
6. debian/tests/util
27
3username="smbtest$$"8username="smbtest$$"
4password="$$"9password="$$"
510
6echo "Creating a local test user called ${username}"11add_user "${username}" "${password}"
7useradd -m "$username"
8
9echo "Setting samba password for the ${username} user"
10echo "${password}\n${password}" | smbpasswd -s -a ${username}
1112
12echo "Testing with incorrect password: must fail"13echo "Testing with incorrect password: must fail"
13smbclient -L localhost -U ${username}%wrongpass && exit 114smbclient -L localhost -U "${username}"%wrongpass && exit 1
1415
15echo "Testing with correct password: must work"16echo "Testing with correct password: must work"
16smbclient -L localhost -U ${username}%${password}17smbclient -L localhost -U "${username}"%"${password}"
1718
diff --git a/debian/tests/smbclient-share-access b/debian/tests/smbclient-share-access
index 22546f3..b124c0c 100644
--- a/debian/tests/smbclient-share-access
+++ b/debian/tests/smbclient-share-access
@@ -1,34 +1,23 @@
1#!/bin/sh -x1#!/bin/sh
22
3if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then3set -x
4 echo "Adding [homes] share"4set -e
5 cat >> /etc/samba/smb.conf <<EOFEOF5
6[homes]6. debian/tests/util
7 valid users = %S
8 read only = no
9 guest ok = no
10EOFEOF
11 systemctl reload smbd.service
12else
13 echo "No need to add [homes] share, continuing."
14fi
157
16username="smbtest$$"8username="smbtest$$"
17password="$$"9password="$$"
18echo "Creating a local test user called ${username}"10add_user "${username}" "${password}"
19useradd -m "$username"11
20echo "Setting samba password for the ${username} user"12myshare="myshare$$"
21echo "${password}\n${password}" | smbpasswd -s -a ${username}13add_share "${myshare}"
22userhome=$(eval echo ~$username)14
23echo "Creating file with random data and computing its md5"15echo "Creating file with random data and computing its md5"
24dd if=/dev/urandom bs=1 count=128 2>/dev/null | base64 > ${userhome}/data16populate_share "${myshare}" "${username}"
25chown ${username}:${username} ${userhome}/data
26cd ${userhome}
27md5sum data > data.md5
2817
29rm -f downloaded-data18rm -f downloaded-data
30echo "Downloading file and comparing its md5"19echo "Downloading file and comparing its md5"
31smbclient //localhost/${username} -U ${username}%${password} -c "get data downloaded-data"20smbclient //localhost/"${myshare}" -U "${username}"%"${password}" -c "get data downloaded-data"
3221
33mv -f downloaded-data data22mv -f downloaded-data data
34md5sum -c data.md523md5sum -c data.md5
diff --git a/debian/tests/smbclient-share-access-uring b/debian/tests/smbclient-share-access-uring
35new file mode 10064424new file mode 100644
index 0000000..e6dc017
--- /dev/null
+++ b/debian/tests/smbclient-share-access-uring
@@ -0,0 +1,29 @@
1#!/bin/sh
2
3set -x
4set -e
5
6ARCH=$(dpkg --print-architecture)
7if [ "$ARCH" = "i386" ]; then
8 echo "liburing not available on $ARCH, skipping test"
9 exit 77
10fi
11
12. debian/tests/util
13
14username="smbtest$$"
15password="$$"
16add_user "${username}" "${password}"
17
18myshare="myshare$$"
19add_share "${myshare}" io_uring
20
21echo "Creating file with random data and computing its md5"
22populate_share "${myshare}" "${username}"
23
24rm -f downloaded-data
25echo "Downloading file and comparing its md5"
26smbclient //localhost/"${myshare}" -U "${username}"%"${password}" -c "get data downloaded-data"
27
28mv -f downloaded-data data
29md5sum -c data.md5
diff --git a/debian/tests/util b/debian/tests/util
0new file mode 10064430new file mode 100644
index 0000000..8c5d452
--- /dev/null
+++ b/debian/tests/util
@@ -0,0 +1,49 @@
1#!/bin/sh
2
3# $1: share name
4# $2: comma separated list of vfs_objects to use, if any
5add_share() {
6 local share="$1"
7 local vfs="$2"
8 if ! testparm -s 2>&1 | grep -E "^\[${share}\]"; then
9 echo "Adding [${share}] share"
10 cat >> /etc/samba/smb.conf <<EOFEOF
11[${share}]
12 read only = no
13 guest ok = no
14 path = /${share}
15EOFEOF
16 if [ -n "${vfs}" ]; then
17 echo "vfs objects = ${vfs}" >> /etc/samba/smb.conf
18 fi
19 systemctl restart smbd.service
20 else
21 echo "Share [${share}] already exists, continuing"
22 fi
23}
24
25# $1: username
26# $2: password
27add_user() {
28 local username="$1"
29 local password="$2"
30
31 echo "Creating a local and samba user called ${username}"
32 useradd -m "${username}"
33 echo "Setting samba password for the ${username} user"
34 echo "${password}\n${password}" | smbpasswd -s -a ${username}
35}
36
37# $1: share name
38populate_share() {
39 local sharename="$1"
40 local usergroup="$2"
41 local sharepath="/${sharename}"
42
43 mkdir -p "${sharepath}"
44 dd if=/dev/urandom bs=4096 count=1000 2>/dev/null | base64 > "${sharepath}/data"
45 cd "${sharepath}"
46 md5sum data > data.md5
47 chown -R "${usergroup}:${usergroup}" "${sharepath}"
48}
49

Subscribers

People subscribed via source and target branches