From b85a124ff6ca56c6fcdd31859362c850d638c8b6 Mon Sep 17 00:00:00 2001 From: Andy Walsh Date: Wed, 27 Nov 2019 22:11:16 +0100 Subject: [PATCH] cifsd: update to git (2019-11-27), fix reload/restart not applying smb.conf changes * fix reload/restart not applying luci/smb.conf changes * remove hotfix for 'read only = no' (fixed by upstream) * update documentation, example *cifsd: fix the lost of dos file attributes *cifsd: store FILE_ATTRIBUTE_SPARSE into xattr *cifsd: release v2.0.2 *cifsd-tools: add smb.conf.list file to show supported parameters list *cifsd-tools: set CIFSD_SHARE_FLAG_WRITEABLE flags if read only = no *cifsd-tools: release cifsd-tools v2.0.2 Signed-off-by: Andy Walsh --- kernel/cifsd/Makefile | 6 +-- net/cifsd-tools/Makefile | 8 ++-- net/cifsd-tools/files/cifsd.config.example | 2 +- net/cifsd-tools/files/cifsd.init | 53 +++++++++++++++------- net/cifsd-tools/files/smb.conf.template | 2 +- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/kernel/cifsd/Makefile b/kernel/cifsd/Makefile index 351879f2f..890a5eb4c 100644 --- a/kernel/cifsd/Makefile +++ b/kernel/cifsd/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd.git -PKG_SOURCE_DATE:=2019-11-22 -PKG_SOURCE_VERSION:=511ee7e852c0be06b74fbb3eba69760b86658679 -PKG_MIRROR_HASH:=23040d73230ff6afcea46cf9c51a1aab7b706859471de204da4824bfea5934c8 +PKG_SOURCE_DATE:=2019-11-27 +PKG_SOURCE_VERSION:=b8675c8ac144ece00f3e6bcc5436c8ace99e23e9 +PKG_MIRROR_HASH:=3d67af87f30d837f95510663efc42f1451651dc235987408924b56cb277fc8e8 PKG_MAINTAINER:=Andy Walsh PKG_LICENSE:=GPL-2.0-or-later diff --git a/net/cifsd-tools/Makefile b/net/cifsd-tools/Makefile index 2990eeeed..656cc10d2 100644 --- a/net/cifsd-tools/Makefile +++ b/net/cifsd-tools/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd-tools.git -PKG_SOURCE_DATE:=2019-11-25 -PKG_SOURCE_VERSION:=49d0c40129fe22161999ffb7e059b90089f23078 -PKG_MIRROR_HASH:=cd3702f1387ab643233200dcf5c244989b6d6efa196c69e842791e434eb3eea7 +PKG_SOURCE_DATE:=2019-11-27 +PKG_SOURCE_VERSION:=06fd4153a5d5af1f96a20234f397bd149a8e4832 +PKG_MIRROR_HASH:=2849d2af471e327abc8d67afc91ca767c410e2b307d6554531a0b387d9ad909a PKG_MAINTAINER:=Andy Walsh PKG_LICENSE:=GPL-2.0-or-later @@ -46,7 +46,7 @@ define Package/cifsd-tools/install $(INSTALL_BIN) ./files/cifsd.init $(1)/etc/init.d/cifsd # copy examples until we have a wiki page $(INSTALL_DATA) ./files/cifsd.config.example $(1)/etc/cifs/ - $(INSTALL_DATA) ./files/smb.conf.help $(1)/etc/cifs/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/Documentation/configuration.txt $(1)/etc/cifs/ endef define Package/cifsd-tools/conffiles diff --git a/net/cifsd-tools/files/cifsd.config.example b/net/cifsd-tools/files/cifsd.config.example index d0ffa5b46..dfe08adc6 100644 --- a/net/cifsd-tools/files/cifsd.config.example +++ b/net/cifsd-tools/files/cifsd.config.example @@ -4,8 +4,8 @@ config globals config share option name 'testshare' option path '/tmp' + option read_only 'no' option guest_ok 'yes' option create_mask '0666' option dir_mask '0777' - option writeable 'yes' option force_root '1' diff --git a/net/cifsd-tools/files/cifsd.init b/net/cifsd-tools/files/cifsd.init index c06e19284..048491842 100644 --- a/net/cifsd-tools/files/cifsd.init +++ b/net/cifsd-tools/files/cifsd.init @@ -103,12 +103,8 @@ smb_add_share() [ -n "$browseable" ] && printf "\tbrowseable = %s\n" "$browseable" [ -n "$read_only" ] && printf "\tread only = %s\n" "$read_only" - # possible upstream bug? - if [ "$read_only" = "no" ]; then - printf "\twriteable = yes\n" - else - [ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable" - fi + [ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable" + [ -n "$guest_ok" ] && printf "\tguest ok = %s\n" "$guest_ok" [ -n "$inherit_owner" ] && printf "\tinherit owner = %s\n" "$inherit_owner" @@ -153,6 +149,15 @@ start_service() exit 1 fi + if [ -e /sys/module/cifsd ]; then + if [ -e /sys/class/cifsd-control/kill_server ]; then + # upstream "BUG": ensure changes in smb.conf are reflected on a running kernel-server + echo hard > /sys/class/cifsd-control/kill_server + # we need a extra timeout for the reset + sleep 5 + fi + fi + modprobe cifsd 2> /dev/null if [ ! -e /sys/module/cifsd ]; then logger -t 'cifsd' "modprobe of cifsd module failed, can\'t start cifsd!" @@ -162,6 +167,7 @@ start_service() logger -t 'cifsd' "Starting CIFS/SMB userspace service." procd_open_instance procd_set_param command /usr/sbin/cifsd --n + procd_set_param file /var/etc/cifs/smb.conf procd_close_instance } @@ -169,20 +175,33 @@ stop_service() { logger -t 'cifsd' "Stopping CIFSD userspace service." killall cifsd > /dev/null 2>&1 - sleep 1 - [ -e /sys/class/cifsd-control/kill_server ] && echo hard > /sys/class/cifsd-control/kill_server - sleep 2 + + [ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1 + # With open smb connections rmmod is not possible, without waiting for the long 'ipc timeout', so we use 'kill_server'! + if [ -e /sys/module/cifsd ]; then + logger -t 'cifsd' "triggering kill_server" + if [ -e /sys/class/cifsd-control/kill_server ]; then + echo hard > /sys/class/cifsd-control/kill_server + # we need a extra timeout for the reset + sleep 5 + fi + fi + # next try [ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1 - # With open smb connections rmmod takes longer + # check again if [ -e /sys/module/cifsd ]; then - sleep 5 - rmmod cifsd > /dev/null 2>&1 + # wait more... + sleep 3 + fi + # last try + [ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1 + + if [ -e /sys/module/cifsd ]; then + logger -t 'cifsd' "module still loaded after 8s timeout" fi [ -f /tmp/cifsd.lock ] && rm /tmp/cifsd.lock } -reload_service() { - stop_service "$@" - sleep 1 - start_service "$@" -} +# reload_service() { + # restart "$@" +# } diff --git a/net/cifsd-tools/files/smb.conf.template b/net/cifsd-tools/files/smb.conf.template index aa54bf2f6..2da98b16e 100644 --- a/net/cifsd-tools/files/smb.conf.template +++ b/net/cifsd-tools/files/smb.conf.template @@ -4,6 +4,6 @@ workgroup = |WORKGROUP| interfaces = |INTERFACES| bind interfaces only = yes - ipc timeout = 8 + ipc timeout = 20 deadtime = 15 map to guest = Bad User