Bo Brantén | 4 Jun 2010 15:29
Picon
Picon
Picon
Favicon

PATCH: Arla CVS Current on Linux 2.6.24-2.6.32


Hello,

I have updated my patch for the latest kernels of Linux. It would be good 
if anyone with CVS access could commit this.

Bo Brantén
diff -uprN arla-cvs/nnpfs/linux/nnpfs_blocks.c arla-cvs-new/nnpfs/linux/nnpfs_blocks.c
--- arla-cvs/nnpfs/linux/nnpfs_blocks.c	2008-03-08 22:38:16.000000000 +0100
+++ arla-cvs-new/nnpfs/linux/nnpfs_blocks.c	2010-06-03 23:32:08.232611383 +0200
 <at>  <at>  -340,6 +340,10  <at>  <at>  nnpfs_block_open(struct nnpfs_node *node
     uid_t saveuid;
     gid_t savegid;
     int ret;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
+    const struct cred *old_cred;
+    struct cred *override_cred;
+#endif
 
     BUG_ON(!nnpfsp);
     BUG_ON(flags & O_CREAT && file != NULL);
 <at>  <at>  -364,10 +368,21  <at>  <at>  nnpfs_block_open(struct nnpfs_node *node
     BUG_ON(!nnpfsp->cachedir || !nnpfsp->cacheroot);
     
     /* use the nfsd trick to give us access */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
     saveuid = current->fsuid;
     savegid = current->fsgid;
     current->fsuid = nnpfsp->uid;
(Continue reading)

Bo Brantén | 5 Jun 2010 11:32
Picon
Picon
Picon
Favicon

Re: PATCH: Arla CVS Current on Linux 2.6.24-2.6.32


A small correction to the patch.

Bo Brantén
diff -uprN arla-cvs/nnpfs/linux/nnpfs_blocks.c arla-cvs-new/nnpfs/linux/nnpfs_blocks.c
--- arla-cvs/nnpfs/linux/nnpfs_blocks.c	2008-03-08 22:38:16.000000000 +0100
+++ arla-cvs-new/nnpfs/linux/nnpfs_blocks.c	2010-06-03 23:32:08.232611383 +0200
 <at>  <at>  -340,6 +340,10  <at>  <at>  nnpfs_block_open(struct nnpfs_node *node
     uid_t saveuid;
     gid_t savegid;
     int ret;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
+    const struct cred *old_cred;
+    struct cred *override_cred;
+#endif
 
     BUG_ON(!nnpfsp);
     BUG_ON(flags & O_CREAT && file != NULL);
 <at>  <at>  -364,10 +368,21  <at>  <at>  nnpfs_block_open(struct nnpfs_node *node
     BUG_ON(!nnpfsp->cachedir || !nnpfsp->cacheroot);
     
     /* use the nfsd trick to give us access */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
     saveuid = current->fsuid;
     savegid = current->fsgid;
     current->fsuid = nnpfsp->uid;
     current->fsgid = nnpfsp->gid;
+#else
(Continue reading)

Bo Brantén | 5 Jun 2010 18:36
Picon
Picon
Picon
Favicon

Re: PATCH: Arla CVS Current on Linux 2.6.24-2.6.35-rc1


Updated to the latest kernel.

Bo Brantén
diff -uprN arla-cvs/nnpfs/linux/nnpfs_blocks.c arla-cvs-new/nnpfs/linux/nnpfs_blocks.c
--- arla-cvs/nnpfs/linux/nnpfs_blocks.c	2008-03-08 22:38:16.000000000 +0100
+++ arla-cvs-new/nnpfs/linux/nnpfs_blocks.c	2010-06-03 23:32:08.232611383 +0200
 <at>  <at>  -340,6 +340,10  <at>  <at>  nnpfs_block_open(struct nnpfs_node *node
     uid_t saveuid;
     gid_t savegid;
     int ret;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
+    const struct cred *old_cred;
+    struct cred *override_cred;
+#endif
 
     BUG_ON(!nnpfsp);
     BUG_ON(flags & O_CREAT && file != NULL);
 <at>  <at>  -364,10 +368,21  <at>  <at>  nnpfs_block_open(struct nnpfs_node *node
     BUG_ON(!nnpfsp->cachedir || !nnpfsp->cacheroot);
     
     /* use the nfsd trick to give us access */
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
     saveuid = current->fsuid;
     savegid = current->fsgid;
     current->fsuid = nnpfsp->uid;
     current->fsgid = nnpfsp->gid;
+#else
+    saveuid = current_fsuid();
(Continue reading)

Tomas Olsson | 29 Jun 2010 23:23
Picon
Picon
Favicon

SV: PATCH: Arla CVS Current on Linux 2.6.24-2.6.35-rc1

> Updated to the latest kernel.
>
Finally applied, please check that I didn't mess anything up.

We may be leaking group_info references in nnpfs_get_pag_group() and store_pag().
And it's probably time for us to drop code for things older than 2.6.27.

thanks
     /t
Bo Brantén | 11 Jul 2010 17:44
Picon
Picon
Picon
Favicon

Re: SV: PATCH: Arla CVS Current on Linux 2.6.24-2.6.35-rc1

On Tue, 29 Jun 2010, Tomas Olsson wrote:

> Finally applied, please check that I didn't mess anything up.

I have now studied the checked in source in CVS and it was almost 
identical to my patch so every thing looks fine the only difference was 
small cosmetic changes like:
-       msg = kmalloc(sizeof(struct nnpfs_message_symlink), GFP_KERNEL);
+       msg = kmalloc(sizeof(*msg), GFP_KERNEL);
So now we are up to date on the Linux kernel, when I have done testing 
reading works very well!

BTW 1: When checking out from CVS two commands is sugested on the 
homepage:
   cvs -R -d /afs/stacken.kth.se/src/SourceRepository checkout arla
and
   env CVS_RSH=ssh \
   cvs -d anoncvs <at> anoncvs.stacken.kth.se:/stacken-cvs checkout arla
only the first one works for me so one needs to have AFS...

BTW 2: When reading the mailing list archive one gets some warning about 
an outdated certificate.

(I will later check/try the OpenBSD patches, also where I am right now 
there is a MacBook with MacOS 10.4, one with 10.5 and one with 10.6 so 
parhaps I should do some testing there too)

Bo Branten
Bo Brantén | 11 Jul 2010 18:29
Picon
Picon
Picon
Favicon

Re: SV: PATCH: Arla CVS Current on Linux 2.6.24-2.6.35-rc1

On Tue, 29 Jun 2010, Tomas Olsson wrote:

> We may be leaking group_info references in nnpfs_get_pag_group() and store_pag().

Yes, the reference count is decremented with put_group_info() but it is 
two possible ways to fix it, I think the second one is the most correct:

nnpfs_get_pag_group(void)
{
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
     struct group_info *gi = current->group_info;
     nnpfs_pag_t ret = current->uid;
#else
     struct group_info *gi = get_current_groups();
     nnpfs_pag_t ret = current_uid();
#endif
     int i;

     get_group_info(gi);

     i = find_pag(gi);
     if (i != NNPFS_PAG_NOTFOUND)
         ret = GROUP_AT(gi, i);

     put_group_info(gi);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)
     put_group_info(gi);
#endif

     NNPFSDEB(XDEBSYS, ("nnpfs_get_pag_group: returning %u\n", ret));
(Continue reading)

Bo Brantén | 11 Jul 2010 18:59
Picon
Picon
Picon
Favicon

Re: PATCH: Arla CVS Current on Linux 2.6.24-2.6.35-rc1


fix for leak in a reference count

(this patch is rather small now since tol has checked in all the other 
stuff in CVS)

Bo Branten
diff -uprN arla-new-cvs.bak/nnpfs/linux/nnpfs_syscalls.c arla-new-cvs/nnpfs/linux/nnpfs_syscalls.c
--- arla-new-cvs.bak/nnpfs/linux/nnpfs_syscalls.c	2010-06-29 23:14:15.000000000 +0200
+++ arla-new-cvs/nnpfs/linux/nnpfs_syscalls.c	2010-07-11 18:45:36.002095539 +0200
 <at>  <at>  -257,7 +257,9  <at>  <at>  nnpfs_get_pag_group(void)
 #endif
     int i;
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)
     get_group_info(gi);
+#endif
 
     i = find_pag(gi);
     if (i != NNPFS_PAG_NOTFOUND)
 <at>  <at>  -287,7 +289,9  <at>  <at>  store_pag(nnpfs_pag_t pagnum)
     int found = 0;
     int i, k;
     
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28)    
     get_group_info(old_gi);
+#endif
 
(Continue reading)


Gmane