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

Update scan failed

At least one of the branches involved have failed to scan. You can manually schedule a rescan if required.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 019552e..406edda 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,23 @@
6+samba (2:4.12.5+dfsg-3ubuntu2) groovy; urgency=medium
7+
8+ * d/t/smbclient-anonymous-share-list: add set -x and set -e
9+ * Factor out common DEP8 test code into d/t/util and change the tests
10+ to source from it:
11+ - d/t/util: added
12+ - d/t/cifs-share-access, d/t/smbclient-share-access: source from
13+ util, use random share name and add set -x and set -u
14+ - d/t/smbclient-authenticated-share-list: source from util and add
15+ set -x and set -u
16+ * d/control: enable the liburing vfs module, except on i386 where
17+ liburing is not available
18+ * Add new DEP8 tests for the uring vfs module:
19+ - d/t/control: add smbclient-share-access-uring and
20+ cifs-share-access-uring tests
21+ - d/t/smbclient-share-access-uring: new test
22+ - d/t/cifs-share-access-uring: new test
23+
24+ -- Andreas Hasenack <andreas@canonical.com> Tue, 04 Aug 2020 17:20:30 -0300
25+
26 samba (2:4.12.5+dfsg-3ubuntu1) groovy; urgency=medium
27
28 * Merge with Debian unstable. Remaining changes:
29diff --git a/debian/control b/debian/control
30index 790dc6a..088a9bb 100644
31--- a/debian/control
32+++ b/debian/control
33@@ -45,6 +45,7 @@ Build-Depends: bison,
34 libtasn1-bin,
35 libtdb-dev (>= 1.4.3~),
36 libtevent-dev (>= 0.10.2~),
37+ liburing-dev [!i386],
38 perl,
39 pkg-config,
40 po-debconf,
41diff --git a/debian/tests/cifs-share-access b/debian/tests/cifs-share-access
42index acfb70a..47ce01a 100644
43--- a/debian/tests/cifs-share-access
44+++ b/debian/tests/cifs-share-access
45@@ -1,34 +1,23 @@
46-#!/bin/sh -x
47+#!/bin/sh
48
49-if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then
50- echo "Adding [homes] share"
51- cat >> /etc/samba/smb.conf <<EOFEOF
52-[homes]
53- valid users = %S
54- read only = no
55- guest ok = no
56-EOFEOF
57- systemctl reload smbd.service
58-else
59- echo "No need to add [homes] share, continuing."
60-fi
61+set -x
62+set -e
63+
64+. debian/tests/util
65
66 username="smbtest$$"
67 password="$$"
68-echo "Creating a local test user called ${username}"
69-useradd -m "$username"
70-echo "Setting samba password for the ${username} user"
71-echo "${password}\n${password}" | smbpasswd -s -a ${username}
72-userhome=$(eval echo ~$username)
73+add_user "${username}" "${password}"
74+
75+myshare="myshare$$"
76+add_share "${myshare}"
77+
78 echo "Creating file with random data and computing its md5"
79-dd if=/dev/urandom bs=1 count=128 2>/dev/null | base64 > ${userhome}/data
80-chown ${username}:${username} ${userhome}/data
81-cd ${userhome}
82-md5sum data > data.md5
83+populate_share "${myshare}" "${username}"
84
85-echo "Mounting //localhost/${username} via CIFS"
86+echo "Mounting //localhost/${myshare} via CIFS"
87 temp_mount=$(mktemp -d)
88-mount -t cifs //localhost/${username} "$temp_mount" -o user=${username},username=${username},password=${password}
89+mount -t cifs //localhost/"${myshare}" "$temp_mount" -o user="${username}",username="${username}",password="${password}"
90
91 echo "Verifying MD5 via cifs"
92 cd "$temp_mount"
93diff --git a/debian/tests/cifs-share-access-uring b/debian/tests/cifs-share-access-uring
94new file mode 100644
95index 0000000..6bbd3e1
96--- /dev/null
97+++ b/debian/tests/cifs-share-access-uring
98@@ -0,0 +1,35 @@
99+#!/bin/sh
100+
101+set -x
102+set -e
103+
104+ARCH=$(dpkg --print-architecture)
105+if [ "$ARCH" = "i386" ]; then
106+ echo "liburing not available on $ARCH, skipping test"
107+ exit 77
108+fi
109+
110+. debian/tests/util
111+
112+username="smbtest$$"
113+password="$$"
114+add_user "${username}" "${password}"
115+
116+myshare="myshare$$"
117+add_share "${myshare}" io_uring
118+
119+echo "Creating file with random data and computing its md5"
120+populate_share "${myshare}" "${username}"
121+
122+echo "Mounting //localhost/${myshare} via CIFS"
123+temp_mount=$(mktemp -d)
124+mount -t cifs //localhost/"${myshare}" "$temp_mount" -o user="${username}",username="${username}",password="${password}"
125+
126+echo "Verifying MD5 via cifs"
127+cd "$temp_mount"
128+md5sum -c data.md5
129+result=$?
130+cd -
131+umount "$temp_mount"
132+rmdir "$temp_mount"
133+exit "$result"
134diff --git a/debian/tests/control b/debian/tests/control
135index 2ebb31c..3ecb853 100644
136--- a/debian/tests/control
137+++ b/debian/tests/control
138@@ -2,6 +2,10 @@ Tests: cifs-share-access
139 Depends: samba, coreutils, systemd, cifs-utils, passwd
140 Restrictions: needs-root, allow-stderr, isolation-machine
141
142+Tests: cifs-share-access-uring
143+Depends: samba, samba-vfs-modules, coreutils, systemd, cifs-utils, passwd
144+Restrictions: needs-root, allow-stderr, isolation-machine, skippable
145+
146 Tests: python-smoke
147 Depends: python3-samba
148
149@@ -16,3 +20,7 @@ Restrictions: needs-root, allow-stderr, isolation-container
150 Tests: smbclient-share-access
151 Depends: samba, smbclient, coreutils, systemd, passwd
152 Restrictions: needs-root, allow-stderr, isolation-container
153+
154+Tests: smbclient-share-access-uring
155+Depends: samba, samba-vfs-modules, smbclient, coreutils, systemd, passwd
156+Restrictions: needs-root, allow-stderr, isolation-container, skippable
157diff --git a/debian/tests/smbclient-anonymous-share-list b/debian/tests/smbclient-anonymous-share-list
158index a503ae7..e71ef27 100644
159--- a/debian/tests/smbclient-anonymous-share-list
160+++ b/debian/tests/smbclient-anonymous-share-list
161@@ -1,3 +1,6 @@
162-#!/bin/sh -x
163+#!/bin/sh
164+
165+set -x
166+set -e
167
168 smbclient -N -L localhost
169diff --git a/debian/tests/smbclient-authenticated-share-list b/debian/tests/smbclient-authenticated-share-list
170index 71f0994..9fcaf43 100644
171--- a/debian/tests/smbclient-authenticated-share-list
172+++ b/debian/tests/smbclient-authenticated-share-list
173@@ -1,17 +1,18 @@
174-#!/bin/sh -x
175+#!/bin/sh
176+
177+set -x
178+set -e
179+
180+. debian/tests/util
181
182 username="smbtest$$"
183 password="$$"
184
185-echo "Creating a local test user called ${username}"
186-useradd -m "$username"
187-
188-echo "Setting samba password for the ${username} user"
189-echo "${password}\n${password}" | smbpasswd -s -a ${username}
190+add_user "${username}" "${password}"
191
192 echo "Testing with incorrect password: must fail"
193-smbclient -L localhost -U ${username}%wrongpass && exit 1
194+smbclient -L localhost -U "${username}"%wrongpass && exit 1
195
196 echo "Testing with correct password: must work"
197-smbclient -L localhost -U ${username}%${password}
198+smbclient -L localhost -U "${username}"%"${password}"
199
200diff --git a/debian/tests/smbclient-share-access b/debian/tests/smbclient-share-access
201index 22546f3..b124c0c 100644
202--- a/debian/tests/smbclient-share-access
203+++ b/debian/tests/smbclient-share-access
204@@ -1,34 +1,23 @@
205-#!/bin/sh -x
206+#!/bin/sh
207
208-if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then
209- echo "Adding [homes] share"
210- cat >> /etc/samba/smb.conf <<EOFEOF
211-[homes]
212- valid users = %S
213- read only = no
214- guest ok = no
215-EOFEOF
216- systemctl reload smbd.service
217-else
218- echo "No need to add [homes] share, continuing."
219-fi
220+set -x
221+set -e
222+
223+. debian/tests/util
224
225 username="smbtest$$"
226 password="$$"
227-echo "Creating a local test user called ${username}"
228-useradd -m "$username"
229-echo "Setting samba password for the ${username} user"
230-echo "${password}\n${password}" | smbpasswd -s -a ${username}
231-userhome=$(eval echo ~$username)
232+add_user "${username}" "${password}"
233+
234+myshare="myshare$$"
235+add_share "${myshare}"
236+
237 echo "Creating file with random data and computing its md5"
238-dd if=/dev/urandom bs=1 count=128 2>/dev/null | base64 > ${userhome}/data
239-chown ${username}:${username} ${userhome}/data
240-cd ${userhome}
241-md5sum data > data.md5
242+populate_share "${myshare}" "${username}"
243
244 rm -f downloaded-data
245 echo "Downloading file and comparing its md5"
246-smbclient //localhost/${username} -U ${username}%${password} -c "get data downloaded-data"
247+smbclient //localhost/"${myshare}" -U "${username}"%"${password}" -c "get data downloaded-data"
248
249 mv -f downloaded-data data
250 md5sum -c data.md5
251diff --git a/debian/tests/smbclient-share-access-uring b/debian/tests/smbclient-share-access-uring
252new file mode 100644
253index 0000000..e6dc017
254--- /dev/null
255+++ b/debian/tests/smbclient-share-access-uring
256@@ -0,0 +1,29 @@
257+#!/bin/sh
258+
259+set -x
260+set -e
261+
262+ARCH=$(dpkg --print-architecture)
263+if [ "$ARCH" = "i386" ]; then
264+ echo "liburing not available on $ARCH, skipping test"
265+ exit 77
266+fi
267+
268+. debian/tests/util
269+
270+username="smbtest$$"
271+password="$$"
272+add_user "${username}" "${password}"
273+
274+myshare="myshare$$"
275+add_share "${myshare}" io_uring
276+
277+echo "Creating file with random data and computing its md5"
278+populate_share "${myshare}" "${username}"
279+
280+rm -f downloaded-data
281+echo "Downloading file and comparing its md5"
282+smbclient //localhost/"${myshare}" -U "${username}"%"${password}" -c "get data downloaded-data"
283+
284+mv -f downloaded-data data
285+md5sum -c data.md5
286diff --git a/debian/tests/util b/debian/tests/util
287new file mode 100644
288index 0000000..8c5d452
289--- /dev/null
290+++ b/debian/tests/util
291@@ -0,0 +1,49 @@
292+#!/bin/sh
293+
294+# $1: share name
295+# $2: comma separated list of vfs_objects to use, if any
296+add_share() {
297+ local share="$1"
298+ local vfs="$2"
299+ if ! testparm -s 2>&1 | grep -E "^\[${share}\]"; then
300+ echo "Adding [${share}] share"
301+ cat >> /etc/samba/smb.conf <<EOFEOF
302+[${share}]
303+ read only = no
304+ guest ok = no
305+ path = /${share}
306+EOFEOF
307+ if [ -n "${vfs}" ]; then
308+ echo "vfs objects = ${vfs}" >> /etc/samba/smb.conf
309+ fi
310+ systemctl restart smbd.service
311+ else
312+ echo "Share [${share}] already exists, continuing"
313+ fi
314+}
315+
316+# $1: username
317+# $2: password
318+add_user() {
319+ local username="$1"
320+ local password="$2"
321+
322+ echo "Creating a local and samba user called ${username}"
323+ useradd -m "${username}"
324+ echo "Setting samba password for the ${username} user"
325+ echo "${password}\n${password}" | smbpasswd -s -a ${username}
326+}
327+
328+# $1: share name
329+populate_share() {
330+ local sharename="$1"
331+ local usergroup="$2"
332+ local sharepath="/${sharename}"
333+
334+ mkdir -p "${sharepath}"
335+ dd if=/dev/urandom bs=4096 count=1000 2>/dev/null | base64 > "${sharepath}/data"
336+ cd "${sharepath}"
337+ md5sum data > data.md5
338+ chown -R "${usergroup}:${usergroup}" "${sharepath}"
339+}
340+

Subscribers

People subscribed via source and target branches